1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-24 08:21:29 +03:00

Reorganize some of the code that detects expression trees with a depth greater than EXPR_MAX_DEPTH so that they are detected earlier. This further reduces the opportunities for stack overflow. (CVS 5189)

FossilOrigin-Name: 16d4c53a8e4d3cfc1abac3b8bb44d8bfd9471e32
This commit is contained in:
danielk1977
2008-06-05 16:47:39 +00:00
parent 861f74563d
commit 4b5255ac31
5 changed files with 123 additions and 97 deletions

View File

@@ -14,7 +14,7 @@
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.243 2008/04/17 20:59:38 drh Exp $
** @(#) $Id: parse.y,v 1.244 2008/06/05 16:47:39 danielk1977 Exp $
*/
// All token codes are small integers with #defines that begin with "TK_"
@@ -773,7 +773,7 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
A = sqlite3PExpr(pParse, TK_IN, X, 0, 0);
if( A ){
A->pList = Y;
sqlite3ExprSetHeight(A);
sqlite3ExprSetHeight(pParse, A);
}else{
sqlite3ExprListDelete(Y);
}
@@ -784,7 +784,7 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
A = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
if( A ){
A->pSelect = X;
sqlite3ExprSetHeight(A);
sqlite3ExprSetHeight(pParse, A);
}else{
sqlite3SelectDelete(X);
}
@@ -794,7 +794,7 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
A = sqlite3PExpr(pParse, TK_IN, X, 0, 0);
if( A ){
A->pSelect = Y;
sqlite3ExprSetHeight(A);
sqlite3ExprSetHeight(pParse, A);
}else{
sqlite3SelectDelete(Y);
}
@@ -806,7 +806,7 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
A = sqlite3PExpr(pParse, TK_IN, X, 0, 0);
if( A ){
A->pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
sqlite3ExprSetHeight(A);
sqlite3ExprSetHeight(pParse, A);
}else{
sqlite3SrcListDelete(pSrc);
}
@@ -818,7 +818,7 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
if( p ){
p->pSelect = Y;
sqlite3ExprSpan(p,&B,&E);
sqlite3ExprSetHeight(A);
sqlite3ExprSetHeight(pParse, A);
}else{
sqlite3SelectDelete(Y);
}
@@ -830,7 +830,7 @@ expr(A) ::= CASE(C) case_operand(X) case_exprlist(Y) case_else(Z) END(E). {
A = sqlite3PExpr(pParse, TK_CASE, X, Z, 0);
if( A ){
A->pList = Y;
sqlite3ExprSetHeight(A);
sqlite3ExprSetHeight(pParse, A);
}else{
sqlite3ExprListDelete(Y);
}