Re: empty array can crash backend using int_array_enum from contrib. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: empty array can crash backend using int_array_enum from contrib.
Date
Msg-id 7036.1114234851@sss.pgh.pa.us
Whole thread Raw
In response to empty array can crash backend using int_array_enum from contrib.  (Ron Mayer <rm_pg@cheapcomplexdevices.com>)
List pgsql-bugs
Ron Mayer <rm_pg@cheapcomplexdevices.com> writes:
> Using the int_array_enum function from contrib/intagg I can crash the 8.0.2 backend when I pass it an empty array.

Man, we've had a few problems with that thing, haven't we?

I patched it along these lines:

*** contrib/intagg/int_aggregate.c.orig    Thu Apr 14 14:16:08 2005
--- contrib/intagg/int_aggregate.c    Sat Apr 23 01:32:52 2005
***************
*** 242,247 ****
--- 242,250 ----
              pc->p = p;
              pc->flags = 0;
          }
+         /* Now that we have a detoasted array, verify dimensions */
+         if (pc->p->a.ndim != 1)
+             elog(ERROR, "int_enum only accepts 1-D arrays");
          pc->num = 0;
          fcinfo->context = (Node *) pc;
          MemoryContextSwitchTo(oldcontext);


            regards, tom lane

pgsql-bugs by date:

Previous
From: Oliver Siegmar
Date:
Subject: Re: BUG #1609: Bug in interval datatype for 64 Bit timestamps
Next
From: Kris Jurka
Date:
Subject: V2 protocol -> 8.1 server