Index: third_party/sqlite/src/tool/lempar.c |
diff --git a/third_party/sqlite/src/tool/lempar.c b/third_party/sqlite/src/tool/lempar.c |
index 774b875e21dab65e0e4c65a19e5f7b09e2bd2d2b..fe56d2dc1661eb9c2468ab9b0c763238e79f6252 100644 |
--- a/third_party/sqlite/src/tool/lempar.c |
+++ b/third_party/sqlite/src/tool/lempar.c |
@@ -125,7 +125,6 @@ static const YYMINORTYPE yyzerominor = { 0 }; |
** yy_default[] Default action for each state. |
*/ |
%% |
-#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0])) |
/* The next table maps tokens into fallback tokens. If a construct |
** like the following: |
@@ -386,12 +385,13 @@ static int yy_find_shift_action( |
int i; |
int stateno = pParser->yystack[pParser->yyidx].stateno; |
- if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ |
+ if( stateno>YY_SHIFT_COUNT |
+ || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ |
return yy_default[stateno]; |
} |
assert( iLookAhead!=YYNOCODE ); |
i += iLookAhead; |
- if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ |
+ if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ |
if( iLookAhead>0 ){ |
#ifdef YYFALLBACK |
YYCODETYPE iFallback; /* Fallback token */ |
@@ -409,7 +409,15 @@ static int yy_find_shift_action( |
#ifdef YYWILDCARD |
{ |
int j = i - iLookAhead + YYWILDCARD; |
- if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){ |
+ if( |
+#if YY_SHIFT_MIN+YYWILDCARD<0 |
+ j>=0 && |
+#endif |
+#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT |
+ j<YY_ACTTAB_COUNT && |
+#endif |
+ yy_lookahead[j]==YYWILDCARD |
+ ){ |
#ifndef NDEBUG |
if( yyTraceFILE ){ |
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", |
@@ -441,22 +449,22 @@ static int yy_find_reduce_action( |
){ |
int i; |
#ifdef YYERRORSYMBOL |
- if( stateno>YY_REDUCE_MAX ){ |
+ if( stateno>YY_REDUCE_COUNT ){ |
return yy_default[stateno]; |
} |
#else |
- assert( stateno<=YY_REDUCE_MAX ); |
+ assert( stateno<=YY_REDUCE_COUNT ); |
#endif |
i = yy_reduce_ofst[stateno]; |
assert( i!=YY_REDUCE_USE_DFLT ); |
assert( iLookAhead!=YYNOCODE ); |
i += iLookAhead; |
#ifdef YYERRORSYMBOL |
- if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ |
+ if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ |
return yy_default[stateno]; |
} |
#else |
- assert( i>=0 && i<YY_SZ_ACTTAB ); |
+ assert( i>=0 && i<YY_ACTTAB_COUNT ); |
assert( yy_lookahead[i]==iLookAhead ); |
#endif |
return yy_action[i]; |