Re: BUG #14220: pg_get_expr() with an incorrect relation id crashes the server
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: christopher.m.hanks@gmail.com, PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Date: 2016-07-01T01:12:06Z
Lists: pgsql-bugs
Attachments
- reject-bogus-attnum-v2.patch (text/x-diff) patch v2
On Fri, Jul 1, 2016 at 5:42 AM, Thomas Munro <thomas.munro@enterprisedb.com> wrote: > Maybe the attnum bounds check should be an error rather than an > assertion, like in the attached. Thought perhaps with a better > message... Quite interesting report. It looks right to me to do so with an elog(ERROR). + if (attnum > colinfo->num_cols) + elog(ERROR, "cannot decompile bogus attnum: %d", attnum); Why not "incorrect number of arguments: specified %d but found %d" instead? I have poked at this bug report yesterday and today, and found that it is as well possible to hit the second assertion two lines below with a dropped column. So I would like to propose the patch attached to replace both assertions with an elog(ERROR). Test cases are included, though I am not sure if they bring much value. -- Michael