Fix a segfault that could occur following an OOM condition.

FossilOrigin-Name: 9adf6e2469d18bc3bfc0c804cfcaa692e23ab6b3e13465dcfc51c4b111b05cb4
This commit is contained in:
dan 2021-03-04 16:10:23 +00:00
parent aae0f74e64
commit e8dd6a4e77
4 changed files with 66 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Earlier\sdetection\sof\sa\smisplaced\sORDER\sBY\sor\sLIMIT\sclause\sin\sa\scompound\nSELECT.\s\sThis\sprevents\sproblems\sin\srecursive\sCTEs\swith\smultiple\srecursive\nterms\sin\swhich\sthere\sis\san\sORDER\sBY\sor\sLIMIT\sclause\son\sthe\slast\snon-recursive\nterm.
D 2021-03-04T16:03:32.382
C Fix\sa\ssegfault\sthat\scould\soccur\sfollowing\san\sOOM\scondition.
D 2021-03-04T16:10:23.652
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -540,7 +540,7 @@ F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
F src/prepare.c f634a9e799a6b1c136d8ee12479cffa22862bfb807d307b1db406aa0cdb042a5
F src/printf.c 2b03a80d7c11bb422115dca175a18bf430e9c9dbaa0eee63b758f0c022f8f34f
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 889469e6980181ce77ee8ab3fc84bd52ed6c1c3577fd102d52623d66cc65a3d0
F src/resolve.c 022aeaa3f3ef6faf76c48fffa97a7ec906606d175a1cd3dd5c186543fa7a1fa3
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c ec87ae50ab868872aca4c92abd9ed9bd0f5f5c76ceb95b66de32d4012f1b255b
F src/shell.c.in 844417f84df1f6c4fce1c815629a888cfdcf219e86513e9c332bbcc38832f477
@ -1225,6 +1225,7 @@ F test/notify2.test 2ecabaa1305083856b7c39cf32816b612740c161
F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934
F test/notnull.test a37b663d5bb728d66fc182016613fb8e4a0a4bbf3d75b8876a7527f7d4ed3f18
F test/notnull2.test 965a893619751255e59c911a8c58504b3174a3788b1458b7c7365b232209711b
F test/notnullfault.test 6126e31300632070ca6021698393c7fcf61ab4791bc2aa1d6d704242c0fcd4f8
F test/null.test b7ff206a1c60fe01aa2abd33ef9ea83c93727d993ca8a613de86e925c9f2bc6f
F test/nulls1.test 82c5bc33148405f21205865abf13c786084438d573a4ac4e87e11b6091cde526
F test/numcast.test 5d126f7f581432e86a90d1e35cac625164aec4a1
@ -1908,7 +1909,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 9768e7db624fbfe688d61ac06bffca14a169d439d8f65f5a14529af5660d3d2e
R b7b7ec94c5553295fe0ea94425307f6e
U drh
Z 0c82ce08ac9825cd2a29c91b8daceab1
P e893f88750ea64d45922429e022c585748974016404f2a2b7952f5a227865246
R fefc06970223f41fbfb5aaf65f9e4865
U dan
Z dcea2abb16cf955ac0b7ba17a45df39a

View File

@ -1 +1 @@
e893f88750ea64d45922429e022c585748974016404f2a2b7952f5a227865246
9adf6e2469d18bc3bfc0c804cfcaa692e23ab6b3e13465dcfc51c4b111b05cb4

View File

@ -1052,6 +1052,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
assert( pWin==pExpr->y.pWin );
if( IN_RENAME_OBJECT==0 ){
sqlite3WindowUpdate(pParse, pSel ? pSel->pWinDefn : 0, pWin, pDef);
if( pParse->db->mallocFailed ) break;
}
sqlite3WalkExprList(pWalker, pWin->pPartition);
sqlite3WalkExprList(pWalker, pWin->pOrderBy);

56
test/notnullfault.test Normal file
View File

@ -0,0 +1,56 @@
# 2021 February 15
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The
# focus of this file is testing optimizations associated with "IS NULL"
# and "IS NOT NULL" operators on columns with NOT NULL constraints.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix notnullfault
do_execsql_test 1.0 {
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d NOT NULL);
}
faultsim_save_and_close
do_faultsim_test 1 -prep {
faultsim_restore_and_reopen
} -body {
execsql {
SELECT * FROM t2 WHERE d NOT NULL
}
} -test {
faultsim_test_result {0 {}}
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE t1(a, b, c);
CREATE TABLE t2(a, b, c, PRIMARY KEY(a, b, c)) WITHOUT ROWID;
}
faultsim_save_and_close
do_faultsim_test 2.1 -faults oom-t* -prep {
faultsim_restore_and_reopen
} -body {
execsql {
SELECT dense_rank() OVER win FROM t2
WINDOW win AS (ORDER BY c IS NULL)
}
} -test {
faultsim_test_result {0 {}}
}
finish_test