aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2007-05-10 10:46:56 +0000
committerdanielk1977 <danielk1977@noemail.net>2007-05-10 10:46:56 +0000
commitfc9760654ae33e2385d15fef23a77de0ce7ed05f (patch)
tree424facab1d365a44d7575058432716dfb4d17233 /src/select.c
parente305f43f1782896906e699fd67c2559daeca09a9 (diff)
downloadsqlite-fc9760654ae33e2385d15fef23a77de0ce7ed05f.tar.gz
sqlite-fc9760654ae33e2385d15fef23a77de0ce7ed05f.zip
Add code to enforce the MAX_EXPR_DEPTH limit. (CVS 3968)
FossilOrigin-Name: 2c9c94a24d52a1c9f5d1b32cbdff794a2dd74126
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/select.c b/src/select.c
index 83c9d6b67..dd8b81d82 100644
--- a/src/select.c
+++ b/src/select.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.343 2007/05/09 22:56:39 drh Exp $
+** $Id: select.c,v 1.344 2007/05/10 10:46:57 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -2940,8 +2940,21 @@ int sqlite3Select(
}else{
needRestoreContext = 0;
}
+#if SQLITE_MAX_EXPR_DEPTH>0
+ /* Increment Parse.nHeight by the height of the largest expression
+ ** tree refered to by this, the parent select. The child select
+ ** may contain expression trees of at most
+ ** (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit
+ ** more conservative than necessary, but much easier than enforcing
+ ** an exact limit.
+ */
+ pParse->nHeight += sqlite3SelectExprHeight(p);
+#endif
sqlite3Select(pParse, pItem->pSelect, SRT_EphemTab,
pItem->iCursor, p, i, &isAgg, 0);
+#if SQLITE_MAX_EXPR_DEPTH>0
+ pParse->nHeight -= sqlite3SelectExprHeight(p);
+#endif
if( needRestoreContext ){
pParse->zAuthContext = zSavedAuthContext;
}