Re: [BUGS] Server crash while trying to read expression using pg_get_expr()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Kris Jurka <books(at)ejurka(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Rushabh Lathia <rushabh(dot)lathia(at)enterprisedb(dot)com>
Subject: Re: [BUGS] Server crash while trying to read expression using pg_get_expr()
Date: 2010-06-09 21:34:34
Message-ID: 1658.1276119274@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Jun 9, 2010 at 2:04 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Mark Kirkwood 2010-06-09 22:03:15 Re: Bad optimizer data for xml (WAS: xml data type implications of no =)
Previous Message Tom Lane 2010-06-09 21:24:28 Re: [BUGS] Server crash while trying to read expression using pg_get_expr()

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-06-09 22:42:43 Re: failover vs. read only queries
Previous Message Tom Lane 2010-06-09 21:24:28 Re: [BUGS] Server crash while trying to read expression using pg_get_expr()