1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Bug fixes in the function that expands the parser stack.

FossilOrigin-Name: e91179fe849760771c3508b1e7d75325183e5c3b029752d0a97dbdbd57188b97
This commit is contained in:
drh
2024-01-26 20:57:19 +00:00
parent 82bf13796a
commit 51f652de10
4 changed files with 12 additions and 15 deletions

View File

@ -293,7 +293,7 @@ static const char *const yyRuleName[] = {
** of errors. Return 0 on success.
*/
static int yyGrowStack(yyParser *p){
int oldSize = 1 + (int)(p->yystackEnd - p->yystack)/sizeof(p->yystack[0]);
int oldSize = 1 + (int)(p->yystackEnd - p->yystack);
int newSize;
int idx;
yyStackEntry *pNew;
@ -303,7 +303,7 @@ static int yyGrowStack(yyParser *p){
if( p->yystack==p->yystk0 ){
pNew = YYREALLOC(0, newSize*sizeof(pNew[0]));
if( pNew==0 ) return 1;
memcpy(pNew, p->yystk0, sizeof(p->yystk0));
memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0]));
}else{
pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0]));
if( pNew==0 ) return 1;