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

Commit8b56928

Browse files
committed
Add a stack overflow check to copyObject().
There are some code paths, such as SPI_execute(), where we invokecopyObject() on raw parse trees before doing parse analysis on them. Sincethe bison grammar is capable of building heavily nested parsetrees whileitself using only minimal stack depth, this means that copyObject() can bethe front-line function that hits stack overflow before anything else does.Accordingly, it had better have a check_stack_depth() call. I did a bit ofperformance testing and found that this slows down copyObject() by only afew percent, so the hit ought to be negligible in the context of completeprocessing of a query.Per off-list report from Toshihide Katayama. Back-patch to all supportedbranches.
1 parentaf1a614 commit8b56928

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎src/backend/nodes/copyfuncs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include"postgres.h"
2424

25+
#include"miscadmin.h"
2526
#include"nodes/plannodes.h"
2627
#include"nodes/relation.h"
2728
#include"utils/datum.h"
@@ -3667,6 +3668,9 @@ copyObject(void *from)
36673668
if (from==NULL)
36683669
returnNULL;
36693670

3671+
/* Guard against stack overflow due to overly complex expressions */
3672+
check_stack_depth();
3673+
36703674
switch (nodeTag(from))
36713675
{
36723676
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp