Prevent stack overflow in exprLocation()

exprLocation() recurses down to the leftmost token of an expression
without checking the stack depth.  A statement like:

    (SELECT 1 ORDER BY 1) ORDER BY 1+1+...+1

with a million terms therefore crashed the backend while computing the
error position for "multiple ORDER BY clauses not allowed".

Author: Zsolt Parragi <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/can4czfojzyq73oxeyrs2qch7ffbdwqeasndikm1g0hb9cn6...@mail.gmail.com
Backpatch-through: 15

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f296a4148f429ae69359ed65c85417a3bd9f6f56

Modified Files
--------------
src/backend/nodes/nodeFuncs.c | 4 ++++
1 file changed, 4 insertions(+)

Reply via email to