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

The tokenizer should never return a negative size of the next token.

Ticket #453. (CVS 1098)

FossilOrigin-Name: 4fbca3ab09596c530da7c50657f3bc9140178dd5
This commit is contained in:
drh
2003-09-12 02:08:14 +00:00
parent 9faae94118
commit 61b487d02a
4 changed files with 20 additions and 15 deletions

View File

@@ -15,7 +15,7 @@
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.62 2003/09/06 22:18:08 drh Exp $
** $Id: tokenize.c,v 1.63 2003/09/12 02:08:15 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -214,9 +214,8 @@ static const char isIdChar[] = {
/*
** Return the length of the token that begins at z[0]. Return
** -1 if the token is (or might be) incomplete. Store the token
** type in *tokenType before returning.
** Return the length of the token that begins at z[0].
** Store the token type in *tokenType before returning.
*/
static int sqliteGetToken(const unsigned char *z, int *tokenType){
int i;
@@ -227,7 +226,6 @@ static int sqliteGetToken(const unsigned char *z, int *tokenType){
return i;
}
case '-': {
if( z[1]==0 ) return -1;
if( z[1]=='-' ){
for(i=2; z[i] && z[i]!='\n'; i++){}
*tokenType = TK_COMMENT;
@@ -426,7 +424,6 @@ int sqliteRunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
pParse->sLastToken.dyn = 0;
pParse->zTail = zSql;
while( sqlite_malloc_failed==0 && zSql[i]!=0 ){
assert( i>=0 );
pParse->sLastToken.z = &zSql[i];
assert( pParse->sLastToken.dyn==0 );