diff --git a/ChangeLog.md b/ChangeLog.md index 74c8fb73bf..9e1ed29970 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -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 diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c b/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c index 3b239dc4f7..5bb7412eb2 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c +++ b/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c @@ -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* tokensPtr = yypParser->yystack[yypParser->yyidx].tokens; *tokensPtr = allTokensWithAllInherited + *tokensPtr; @@ -1023,4 +1023,4 @@ void Parse( } }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); return; -} \ No newline at end of file +} diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp index c9d233cd3c..eed8b607d8 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp @@ -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, @@ -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* tokensPtr = yypParser->yystack[yypParser->yyidx].tokens; *tokensPtr = allTokensWithAllInherited + *tokensPtr; @@ -6131,4 +6131,4 @@ void sqlite3_parse( } }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); return; -} \ No newline at end of file +}