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

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: 578a0d3fcde12c6f16d123bc5abc56dab93390fa
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2010-06-30T18:11:04Z
Releases: 8.2.18
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