1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Fix a crash that could follow an OOM error while processing aggregate functions.

FossilOrigin-Name: 804435a2731bd3c26278c47098854b9ee7727a686587f6208e793738fbfc0555
This commit is contained in:
dan
2023-03-30 11:05:36 +00:00
parent e1afa2bd24
commit 8fe84a40c7
4 changed files with 52 additions and 7 deletions

43
test/aggfault.test Normal file
View File

@ -0,0 +1,43 @@
# 2023 March 30
#
# 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.
#
#***********************************************************************
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix aggfault
do_execsql_test 1 {
CREATE TABLE t1(x);
CREATE TABLE t1x ON t1(x, x=0);
}
faultsim_save_and_close
do_faultsim_test 2 -faults oom* -prep {
faultsim_restore_and_reopen
execsql { SELECT * FROM sqlite_schema }
} -body {
execsql {
SELECT * FROM t1 AS a1 WHERE (
SELECT count(x AND 0=a1.x) FROM t1 GROUP BY abs(1)
) AND x=(
SELECT * FROM t1 AS a1
WHERE (SELECT count(x IS 1 AND a1.x=0)
FROM t1
GROUP BY abs(1)) AND x=0
);
}
} -test {
faultsim_test_result {0 {}}
}
finish_test