stringToNode() and deparse_expression_pretty() crash on invalid input,

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: fc1adce4aa002bffd1f70ae470a38714cf0b7b23
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2010-06-30T18:10:51Z
Releases: 8.3.12
stringToNode() and deparse_expression_pretty() crash on invalid input,
but we have nevertheless exposed them to users via pg_get_expr(). It would
be too much maintenance effort to rigorously check the input, so put a hack
in place instead to restrict pg_get_expr() so that the argument must come
from one of the system catalog columns known to contain valid expressions.

Per report from Rushabh Lathia. Backpatch to 7.4 which is the oldest
supported version at the moment.

Files

PathChange+/−
src/backend/parser/parse_expr.c modified +81 −2
src/backend/tcop/fastpath.c modified +12 −1