1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix a crash that could occur following an OOM in the group_concat() function

if the second argument is an SQLITE_BLOB value.

FossilOrigin-Name: 14d855d2b2b5b3485e0673d11405db7266b34c6d
This commit is contained in:
dan
2016-12-30 17:40:14 +00:00
parent 1d081ab39e
commit 3043b53222
6 changed files with 101 additions and 11 deletions

View File

@ -29,6 +29,8 @@ foreach {enc} {
utf16
} {
reset_db
sqlite3_db_config_lookaside db 0 0 0
execsql "PRAGMA encoding = $enc"
do_execsql_test 1.$enc.1 {
CREATE TABLE t1(n, h);
@ -63,6 +65,28 @@ foreach {enc} {
faultsim_test_result {0 31}
sqlite3_finalize $::stmt
}
do_faultsim_test 1.$enc.4 -faults oom-t* -prep {
set ::stmt [sqlite3_prepare_v2 db "SELECT instr(?, ?)" -1 dummy]
sqlite3_bind_blob $::stmt 1 $::HAYSTACK [string length $::HAYSTACK]
sqlite3_bind_text $::stmt 2 $::NEEDLE [string length $::NEEDLE]
} -body {
set rc [sqlite3_step $::stmt]
if {$rc=="SQLITE_NOMEM"} { error "out of memory" }
sqlite3_column_int $::stmt 0
} -test {
faultsim_test_result {0 31}
sqlite3_finalize $::stmt
}
do_execsql_test 1.$enc.5.0 {
CREATE TABLE h1(a, b);
INSERT INTO h1 VALUES('abcdefg%200hijkl', randomblob(200));
INSERT INTO h1 SELECT b, a FROM h1;
}
do_faultsim_test 1.$enc.5 -faults oom-t* -body {
execsql { SELECT rowid FROM h1 WHERE instr(a,b) }
} -test {}
}
finish_test