Skip to content

Commit

Permalink
#4658 Fixed crash when SQL parser stack gets overflown.
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelsalawa committed Jan 19, 2023
1 parent 0bb3edf commit 5484ead
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### 3.4.3
- CHANGE: #4631 Linux binaries are built again back on Ubuntu 20.04 (instead of 22.04) to make it compatible for more Linux machines.
- BUGFIX: #4658 Fixed crash when SQL parser stack gets overflown.
- BUGFIX: Removed unnecessary linking to curses library in Linux build file.

### 3.4.2
Expand Down
4 changes: 2 additions & 2 deletions SQLiteStudio3/coreSQLiteStudio/parser/lempar.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ static void yy_reduce(
#endif
{
yy_shift(yypParser,yyact,yygoto,&yygotominor);
if (parserContext->setupTokens)
if (parserContext->setupTokens && yypParser->yyidx >= 0)
{
QList<Token*>* tokensPtr = yypParser->yystack[yypParser->yyidx].tokens;
*tokensPtr = allTokensWithAllInherited + *tokensPtr;
Expand Down Expand Up @@ -1023,4 +1023,4 @@ void Parse(
}
}while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
return;
}
}
6 changes: 3 additions & 3 deletions SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ static const short yy_shift_ofst[] = {
/* 0 */ 1591, 808, 1446, 138, 1318, 1603, 1364, 2114, 2114, 2114,
/* 10 */ 1260, 216, 2012, 2216, 2318, 2216, 2216, 2216, 2216, 2216,
/* 20 */ 2216, 949, -4, 106, 1910, 1808, 2216, 2216, 2216, 2216,
/* 30 */ 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216,
/* 30 */ 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2318, 2216,
/* 40 */ 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216,
/* 50 */ 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216,
/* 60 */ 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216,
Expand Down Expand Up @@ -5889,7 +5889,7 @@ static void yy_reduce(
#endif
{
yy_shift(yypParser,yyact,yygoto,&yygotominor);
if (parserContext->setupTokens)
if (parserContext->setupTokens && yypParser->yyidx >= 0)
{
QList<Token*>* tokensPtr = yypParser->yystack[yypParser->yyidx].tokens;
*tokensPtr = allTokensWithAllInherited + *tokensPtr;
Expand Down Expand Up @@ -6131,4 +6131,4 @@ void sqlite3_parse(
}
}while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
return;
}
}

0 comments on commit 5484ead

Please sign in to comment.