From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Check get_tle_by_resno() result before deref |
Date: | 2013-07-15 19:04:43 |
Message-ID: | E1Uyo4h-0003EO-Cn@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Check get_tle_by_resno() result before deref
When creating a sort to support a group by, we need to look up the
target entry in the target list by the resno using get_tle_by_resno().
This particular code-path didn't check the result prior to attempting
to dereference it, while all other callers did. While I can't see a
way for this usage of get_tle_by_resno() to fail (you can't ask for
a column to be sorted on which isn't included in the group by), it's
probably best to check that we didn't end up with a NULL somehow
anyway than risk the segfault.
I'm willing to back-patch this if others feel it's necessary, but my
guess is new features are what might tickle this rather than anything
existing.
Missing check spotted by the Coverity scanner.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/4ed22e891f9915b02b753ee8763a8f2438234fc6
Modified Files
--------------
src/backend/optimizer/plan/createplan.c | 3 +++
1 file changed, 3 insertions(+)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2013-07-16 00:30:52 | pgsql: Fix PQconninfoParse error message handling |
Previous Message | Robert Haas | 2013-07-15 18:29:51 | pgsql: Tab completion for \lo_import |