mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
If sqlite3_column_value() is called to obtain a value with the MEM_Static flag set, clear it and set the MEM_Ephem flag before returning. Otherwise, if the value is passed to sqlite3_bind_value() or sqlite3_result_value(), sqlite may attempt to use the buffer after the statement has been finalized. This is not always valid, as MEM_Static only guarantees that a MEM.z buffer will be valid for the lifetime of the owner statement, not that it is actually a static buffer. (CVS 5812)
FossilOrigin-Name: b055bfc4e5268d8a66d6a4f5e8aec1285fe4b8e7
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# $Id: vtab2.test,v 1.8 2008/01/31 15:53:46 drh Exp $
|
||||
# $Id: vtab2.test,v 1.9 2008/10/13 10:37:50 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -105,4 +105,32 @@ do_test vtab2-3.2 {
|
||||
}
|
||||
} {main schema 0 database {} 0 {} 0 {} {} {} {} {} {} {} {} {}}
|
||||
|
||||
do_test vtab2-4.1 {
|
||||
execsql {
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, UNIQUE(b, c));
|
||||
CREATE TABLE fkey(
|
||||
to_tbl,
|
||||
to_col
|
||||
);
|
||||
INSERT INTO "fkey" VALUES('t1',NULL);
|
||||
COMMIT;
|
||||
}
|
||||
} {}
|
||||
do_test vtab2-4.2 {
|
||||
execsql { CREATE VIRTUAL TABLE v_col USING schema }
|
||||
} {}
|
||||
do_test vtab2-4.3 {
|
||||
execsql { SELECT name FROM v_col WHERE tablename = 't1' AND pk }
|
||||
} {a}
|
||||
do_test vtab2-4.4 {
|
||||
execsql {
|
||||
UPDATE fkey
|
||||
SET to_col = (SELECT name FROM v_col WHERE tablename = 't1' AND pk);
|
||||
}
|
||||
} {}
|
||||
do_test vtab2-4.5 {
|
||||
execsql { SELECT * FROM fkey }
|
||||
} {t1 a}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user