Re: PL/Python error checking

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: PL/Python error checking
Date: 2005-09-23 21:03:02
Message-ID: 200509232103.j8NL32H16319@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Michael Fuhr wrote:
> On Mon, Jul 11, 2005 at 08:13:24PM -0600, Michael Fuhr wrote:
> > On Sun, Jul 10, 2005 at 12:58:24AM -0400, Bruce Momjian wrote:
> > > I am unclear about backpatching this. We have to weigh the risks of
> > > applying or not applying to 8.0.X. Comments?
> >
> > Since 7.4, PL/Python is only available as an untrusted language,
> > so only a database superuser could create an exploitable function.
> > However, it might be possible for an ordinary user to tickle the
> > bug by calling such a function and passing it certain data, either
> > as an argument or as table data. The code is buggy in any case:
> > PyObject_Str() is documented to return NULL on error, and
> > PyString_AsString() doesn't expect a NULL pointer so it segfaults
> > if passed one. Since the patch simply checks for that condition
> > and raises an error instead of calling a function that will segfault
> > and take down the backend, I can't think of what risk applying the
> > patch would have. The greater risk would seem to be in not applying
> > it.
>
> I haven't seen this patch applied to other than HEAD. Since it
> fixes a segmentation fault, should it be backpatched before the
> new releases?
>
> Here's the original patch submission:
>
> http://archives.postgresql.org/pgsql-patches/2005-06/msg00519.php

I have backpatched this to 8.0.X. It did not apply cleanly to 7.4.X so
if you would like that version patched please submit a matching patch.
Thanks. (I don't trust myself to adjust the patch for 7.4.X.)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-09-23 21:31:37 Re: Patching dblink.c to avoid warning about open transaction
Previous Message Bruce Momjian 2005-09-23 20:36:59 Re: Improve psql's handling of multi-line queries