Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2faab1a

Browse files
committed
Check for stack overflow in transformSetOperationTree().
Since transformSetOperationTree() recurses, it can be driven to stackoverflow with enough UNION/INTERSECT/EXCEPT clauses in a query. Add acheck to ensure it fails cleanly instead of crashing. Per report fromMatthew Gerber (though it's not clear whether this is the only thinggoing wrong for him).Historical note: I think the reasoning behind not putting a check here inthe beginning was that the check in transformExpr() ought to be sufficientto guard the whole parser. However, because transformSetOperationTree()recurses all the way to the bottom of the set-operation tree before doingany analysis of the statement's expressions, that check doesn't save it.
1 parent29d539b commit2faab1a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎src/backend/parser/analyze.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include"postgres.h"
2626

2727
#include"catalog/pg_type.h"
28+
#include"miscadmin.h"
2829
#include"nodes/makefuncs.h"
2930
#include"optimizer/clauses.h"
3031
#include"optimizer/var.h"
@@ -1238,6 +1239,9 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
12381239

12391240
Assert(stmt&&IsA(stmt,SelectStmt));
12401241

1242+
/* Guard against stack overflow due to overly complex set-expressions */
1243+
check_stack_depth();
1244+
12411245
/*
12421246
* Validity-check both leaf and internal SELECTs for disallowed ops.
12431247
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp