mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Fix a vdbe stack leak that could occur where one side of a WHERE clause inequality evaluated to SQL null. (CVS 4045)
FossilOrigin-Name: 17152bf1a268e130f0c43046bb438b617a747ff5
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
# that IS NULL phrases are correctly optimized. But you can never
|
||||
# have too many tests, so some other tests are thrown in as well.
|
||||
#
|
||||
# $Id: where4.test,v 1.3 2007/03/28 14:30:09 drh Exp $
|
||||
# $Id: where4.test,v 1.4 2007/06/02 07:54:38 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -230,4 +230,36 @@ do_test where4-7.1 {
|
||||
|
||||
integrity_check {where4-99.0}
|
||||
|
||||
do_test where4-7.1 {
|
||||
execsql {
|
||||
BEGIN;
|
||||
CREATE TABLE t8(a, b, c, d);
|
||||
CREATE INDEX t8_i ON t8(a, b, c);
|
||||
CREATE TABLE t7(i);
|
||||
|
||||
INSERT INTO t7 VALUES(1);
|
||||
INSERT INTO t7 SELECT i*2 FROM t7;
|
||||
INSERT INTO t7 SELECT i*2 FROM t7;
|
||||
INSERT INTO t7 SELECT i*2 FROM t7;
|
||||
INSERT INTO t7 SELECT i*2 FROM t7;
|
||||
INSERT INTO t7 SELECT i*2 FROM t7;
|
||||
INSERT INTO t7 SELECT i*2 FROM t7;
|
||||
|
||||
COMMIT;
|
||||
}
|
||||
} {}
|
||||
|
||||
# At one point the sub-select inside the aggregate sum() function in the
|
||||
# following query was leaking a couple of stack entries. This query
|
||||
# runs the SELECT in a loop enough times that an assert() fails. Or rather,
|
||||
# did fail before the bug was fixed.
|
||||
#
|
||||
do_test where4-7.2 {
|
||||
execsql {
|
||||
SELECT sum((
|
||||
SELECT d FROM t8 WHERE a = i AND b = i AND c < NULL
|
||||
)) FROM t7;
|
||||
}
|
||||
} {{}}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user