Re: plpython crash on exception - Mailing list pgsql-patches

From Tom Lane
Subject Re: plpython crash on exception
Date
Msg-id 8803.1195748677@sss.pgh.pa.us
Whole thread Raw
In response to plpython crash on exception  ("Marko Kreen" <markokr@gmail.com>)
Responses Re: plpython crash on exception  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-patches
"Marko Kreen" <markokr@gmail.com> writes:
> Following function crashes plpython on x86-64 / gcc 4.1.2 / debian 4.0:
>   CREATE FUNCTION crashme(str_len integer)
>   RETURNS text AS $$
>     raise Exception("X" * str_len)
>   $$ LANGUAGE plpythonu;

>   SELECT crashme(1000);

> Problem turns out to be va_list handling in PLy_vprintf() which
> uses same va_list repeatedly.  Fix is to va_copy to temp variable.

This patch isn't acceptable because va_copy() isn't portable.

I'm kinda wondering why PLy_printf and the functions after it even
exist.  They look like rather poorly done reimplementations of
functionality that exists elsewhere in the backend (eg, stringinfo.c).
In particular, why malloc and not palloc?

            regards, tom lane

pgsql-patches by date:

Previous
From: Zdenek Kotala
Date:
Subject: Re: Fix pg_dump dependency on postgres.h
Next
From: Alvaro Herrera
Date:
Subject: Re: plpython crash on exception