Re: empty array can crash backend using int_array_enum from contrib.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: empty array can crash backend using int_array_enum from contrib.
Date: 2005-04-23 05:40:51
Message-ID: 7036.1114234851@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kris Jurka 2005-04-23 05:54:37 V2 protocol -> 8.1 server
Previous Message Jeremy Stanley 2005-04-23 00:53:44 BUG #1621: ODBC binding Unicode null-terminated string parameter doesn't work