Faster parser stack overflow detection.

FossilOrigin-Name: 36e54cd8b1fb374fd41e3e09b34b86e34327bf07c9e4bfec58382163c5c5d279
This commit is contained in:
drh 2017-06-28 15:01:35 +00:00
parent 6559e2cec7
commit 8b471e7e79
3 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Minor\stweak\sto\sthe\sSQL\sgrammar\sto\smake\sthe\sparser\stables\sa\sfew\sbytes\ssmaller. C Faster\sparser\sstack\soverflow\sdetection.
D 2017-06-28T14:26:37.622 D 2017-06-28T15:01:35.715
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
@ -1510,7 +1510,7 @@ F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
F tool/lemon.c 5a04dff28578a67415cea5bf981b893c50cebfdd4388fb21254d1892525edfd8 F tool/lemon.c 5a04dff28578a67415cea5bf981b893c50cebfdd4388fb21254d1892525edfd8
F tool/lempar.c 1653b07079a7b4c0eabe6cde5e354013da3cf4de30947d0dc00d045be1e2c9a1 F tool/lempar.c f0dc07c2838febff4c34244651a6932fceb523065e6fe79bacfaa93019cc8cca
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9 F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862 F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
@ -1584,7 +1584,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P b362f0d8ed34839bf3b29d10ed0853ab94245fba135ccd28e619caa6ee6992d5 P cc4810b23e683e8c359f7c1a562338ec8501e43cac3475b2be002568fca5e6a4
R 47fe456950b93480334e354c250c0848 R aecb52c4ffe19d7ddc13e13ae7717a64
U drh U drh
Z 983cf2b86c0c77a70c157e39be586b00 Z deaa1ad68fb12d39469a0630e4b55aa7

View File

@ -1 +1 @@
cc4810b23e683e8c359f7c1a562338ec8501e43cac3475b2be002568fca5e6a4 36e54cd8b1fb374fd41e3e09b34b86e34327bf07c9e4bfec58382163c5c5d279

View File

@ -221,6 +221,7 @@ struct yyParser {
yyStackEntry yystk0; /* First stack entry */ yyStackEntry yystk0; /* First stack entry */
#else #else
yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
yyStackEntry *yystackEnd; /* Last entry in the stack */
#endif #endif
}; };
typedef struct yyParser yyParser; typedef struct yyParser yyParser;
@ -338,6 +339,7 @@ void ParseInit(void *yypParser){
pParser->yytos = pParser->yystack; pParser->yytos = pParser->yystack;
pParser->yystack[0].stateno = 0; pParser->yystack[0].stateno = 0;
pParser->yystack[0].major = 0; pParser->yystack[0].major = 0;
pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
} }
#ifndef Parse_ENGINEALWAYSONSTACK #ifndef Parse_ENGINEALWAYSONSTACK
@ -607,7 +609,7 @@ static void yy_shift(
} }
#endif #endif
#if YYSTACKDEPTH>0 #if YYSTACKDEPTH>0
if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){ if( yypParser->yytos>yypParser->yystackEnd ){
yypParser->yytos--; yypParser->yytos--;
yyStackOverflow(yypParser); yyStackOverflow(yypParser);
return; return;
@ -676,7 +678,7 @@ static void yy_reduce(
} }
#endif #endif
#if YYSTACKDEPTH>0 #if YYSTACKDEPTH>0
if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){ if( yypParser->yytos>=yypParser->yystackEnd ){
yyStackOverflow(yypParser); yyStackOverflow(yypParser);
return; return;
} }