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

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: fa8ccf59faaec5c026e3721642487cab6fa3b34f
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2010-06-30T18:11:43Z
Releases: 7.4.30
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 +90 −1
src/backend/tcop/fastpath.c modified +12 −1
src/include/catalog/pg_constraint.h modified +3 −1