Skip site navigation (1) Skip section navigation (2)

pgsql: Add a stack overflow check to copyObject().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add a stack overflow check to copyObject().
Date: 2010-12-07 03:59:34
Message-ID: E1PPoiE-0003CR-JP@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Add a stack overflow check to copyObject().

There are some code paths, such as SPI_execute(), where we invoke
copyObject() on raw parse trees before doing parse analysis on them.  Since
the bison grammar is capable of building heavily nested parsetrees while
itself using only minimal stack depth, this means that copyObject() can be
the 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 of
performance testing and found that this slows down copyObject() by only a
few percent, so the hit ought to be negligible in the context of complete
processing of a query.

Per off-list report from Toshihide Katayama.  Back-patch to all supported
branches.

Branch
------
REL8_1_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=0ae63a4fb2db1131e0715810199de0c0a8e7c2d8

Modified Files
--------------
src/backend/nodes/copyfuncs.c |    4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

pgsql-committers by date

Next:From: Heikki LinnakangasDate: 2010-12-07 08:41:26
Subject: pgsql: Fix bugs in the hot standby known-assigned-xids trackinglogic.
Previous:From: Andrew DunstanDate: 2010-12-06 20:42:42
Subject: pgsql: Allow the low level COPY routines to read arbitrary numbers off

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group