diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sqliteLimit.h | 6 | ||||
-rw-r--r-- | src/tokenize.c | 4 | ||||
-rw-r--r-- | src/vdbe.c | 21 |
3 files changed, 17 insertions, 14 deletions
diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h index 963284418..64cf1ca1d 100644 --- a/src/sqliteLimit.h +++ b/src/sqliteLimit.h @@ -12,7 +12,7 @@ ** ** This file defines various limits of what SQLite can process. ** -** @(#) $Id: sqliteLimit.h,v 1.5 2007/12/13 21:54:11 drh Exp $ +** @(#) $Id: sqliteLimit.h,v 1.6 2007/12/17 16:20:07 drh Exp $ */ /* @@ -49,10 +49,10 @@ /* ** The maximum length of a single SQL statement in bytes. -** The hard limit is 1 million. +** A value of zero means there is no limit. */ #ifndef SQLITE_MAX_SQL_LENGTH -# define SQLITE_MAX_SQL_LENGTH 1000000 +# define SQLITE_MAX_SQL_LENGTH 0 #endif /* diff --git a/src/tokenize.c b/src/tokenize.c index b4a9b9bc4..b736f5f5e 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,7 +15,7 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.136 2007/08/27 23:26:59 drh Exp $ +** $Id: tokenize.c,v 1.137 2007/12/17 16:20:07 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -418,7 +418,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ assert( pParse->sLastToken.dyn==0 ); pParse->sLastToken.n = getToken((unsigned char*)&zSql[i],&tokenType); i += pParse->sLastToken.n; - if( i>SQLITE_MAX_SQL_LENGTH ){ + if( SQLITE_MAX_SQL_LENGTH>0 && i>SQLITE_MAX_SQL_LENGTH ){ pParse->rc = SQLITE_TOOBIG; break; } diff --git a/src/vdbe.c b/src/vdbe.c index f74e37b45..e9d69af8d 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.660 2007/12/13 21:54:11 drh Exp $ +** $Id: vdbe.c,v 1.661 2007/12/17 16:20:07 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -760,8 +760,6 @@ case OP_String8: { /* same as TK_STRING */ assert( pOp->p3!=0 ); pOp->opcode = OP_String; pOp->p1 = strlen(pOp->p3); - assert( SQLITE_MAX_SQL_LENGTH <= SQLITE_MAX_LENGTH ); - assert( pOp->p1 <= SQLITE_MAX_LENGTH ); #ifndef SQLITE_OMIT_UTF16 if( encoding!=SQLITE_UTF8 ){ @@ -777,11 +775,16 @@ case OP_String8: { /* same as TK_STRING */ pOp->p3type = P3_DYNAMIC; pOp->p3 = pTos->z; pOp->p1 = pTos->n; - assert( pOp->p1 <= SQLITE_MAX_LENGTH ); /* Due to SQLITE_MAX_SQL_LENGTH */ + if( pOp->p1>SQLITE_MAX_LENGTH ){ + goto too_big; + } break; } #endif - /* Otherwise fall through to the next case, OP_String */ + if( pOp->p1>SQLITE_MAX_LENGTH ){ + goto too_big; + } + /* Fall through to the next case, OP_String */ } /* Opcode: String P1 * P3 @@ -789,7 +792,6 @@ case OP_String8: { /* same as TK_STRING */ ** The string value P3 of length P1 (bytes) is pushed onto the stack. */ case OP_String: { - assert( pOp->p1 <= SQLITE_MAX_LENGTH ); /* Due to SQLITE_MAX_SQL_LENGTH */ pTos++; assert( pOp->p3!=0 ); pTos->flags = MEM_Str|MEM_Static|MEM_Term; @@ -823,8 +825,9 @@ case OP_Null: { case OP_HexBlob: { /* same as TK_BLOB */ pOp->opcode = OP_Blob; pOp->p1 = strlen(pOp->p3)/2; - assert( SQLITE_MAX_SQL_LENGTH <= SQLITE_MAX_LENGTH ); - assert( pOp->p1 <= SQLITE_MAX_LENGTH ); + if( pOp->p1>SQLITE_MAX_LENGTH ){ + goto too_big; + } if( pOp->p1 ){ char *zBlob = sqlite3HexToBlob(db, pOp->p3); if( !zBlob ) goto no_mem; @@ -855,7 +858,7 @@ case OP_HexBlob: { /* same as TK_BLOB */ */ case OP_Blob: { pTos++; - assert( pOp->p1 <= SQLITE_MAX_LENGTH ); /* Due to SQLITE_MAX_SQL_LENGTH */ + assert( pOp->p1 <= SQLITE_MAX_LENGTH ); sqlite3VdbeMemSetStr(pTos, pOp->p3, pOp->p1, 0, 0); pTos->enc = encoding; break; |