Re: [BUGS] Server crash while trying to read expression using pg_get_expr() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUGS] Server crash while trying to read expression using pg_get_expr()
Date
Msg-id 1658.1276119274@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] Server crash while trying to read expression using pg_get_expr()  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Jun 9, 2010 at 2:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Well, ideally yes, but if it's not actually *secure* then there's no
>> point --- and I don't believe that the approach of making readfuncs.c
>> secure against malicious input has the proverbial snowball's chance
>> of ever being bulletproof.

> I don't really see how it could be *impossible* to securely parse text
> input.   It's certainly possible not to crash on trivially malformed
> input.

The operative word in that claim is "trivial".  The problem that I see
is that there are many assumptions in the system about the structure and
interrelationships of expression node trees, for instance that certain
List fields contain only certain node types.  I don't believe that it's
practical to make the node reading code enforce every one of those
assumptions, or that it'd be maintainable if we did manage to get it
right to start with.  Certainly we can make the node reading code do
more checking than it does now, but the odds of making things
bulletproof against malicious input are negligible.  I don't want to be
going back to fix another hole every other month for the lifetime of the
project, but that's exactly what we'll be doing if we try to fix it that
way.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [BUGS] Server crash while trying to read expression using pg_get_expr()
Next
From: Simon Riggs
Date:
Subject: Re: hot_standby = on