1. 23 May, 2011 2 commits
    • Tom Lane's avatar
      Install defenses against overflow in BuildTupleHashTable(). · 299d1716
      Tom Lane authored
      The planner can sometimes compute very large values for numGroups, and in
      cases where we have no alternative to building a hashtable, such a value
      will get fed directly to BuildTupleHashTable as its nbuckets parameter.
      There were two ways in which that could go bad.  First, BuildTupleHashTable
      declared the parameter as "int" but most callers were passing "long"s,
      so on 64-bit machines undetected overflow could occur leading to a bogus
      negative value.  The obvious fix for that is to change the parameter to
      "long", which is what I've done in HEAD.  In the back branches that seems a
      bit risky, though, since third-party code might be calling this function.
      So for them, just put in a kluge to treat negative inputs as INT_MAX.
      Second, hash_create can go nuts with extremely large requested table sizes
      (notably, my_log2 becomes an infinite loop for inputs larger than
      LONG_MAX/2).  What seems most appropriate to avoid that is to bound the
      initial table size request to work_mem.
      
      This fixes bug #6035 reported by Daniel Schreiber.  Although the reported
      case only occurs back to 8.4 since it involves WITH RECURSIVE, I think
      it's a good idea to install the defenses in all supported branches.
      299d1716
    • Andrew Dunstan's avatar
  2. 22 May, 2011 6 commits
  3. 21 May, 2011 4 commits
  4. 20 May, 2011 1 commit
  5. 19 May, 2011 9 commits
  6. 18 May, 2011 6 commits
  7. 16 May, 2011 7 commits
  8. 15 May, 2011 3 commits
  9. 13 May, 2011 1 commit
  10. 12 May, 2011 1 commit