0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-25 08:59:33 +01:00
sqlite/ext/rtree/rtreeG.test
dan eab0e10304 In extensions rtree, fts3 and fts5, ensure that when dynamic buffers are bound
to persistent SQL statements using SQLITE_STATIC, the binding is replaced with
an SQL NULL before the buffer is freed. Otherwise, a user may obtain a pointer
to the persistent statement using sqlite3_next_stmt() and attempt to access
the freed buffer using sqlite3_expanded_sql() or similar.

FossilOrigin-Name: 2a5f813bc61f9e780f2ccbda425611f65ad523b6d486a1e5e2b9d5e9f1d260a2
2018-02-07 18:02:50 +00:00

70 lines
1.5 KiB
Plaintext

# 2016-05-32
#
# 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 contains tests for the r-tree module.
#
# Verify that no invalid SQL is run during initialization
if {![info exists testdir]} {
set testdir [file join [file dirname [info script]] .. .. test]
}
source [file join [file dirname [info script]] rtree_util.tcl]
source $testdir/tester.tcl
ifcapable !rtree { finish_test ; return }
db close
sqlite3_shutdown
test_sqlite3_log [list lappend ::log]
set ::log [list]
sqlite3 db test.db
set ::log {}
do_execsql_test rtreeG-1.1 {
CREATE VIRTUAL TABLE t1 USING rtree(id,x0,x1,y0,y1);
} {}
do_test rtreeG-1.1log {
set ::log
} {}
do_execsql_test rtreeG-1.2 {
INSERT INTO t1 VALUES(1,10,15,5,23),(2,20,21,5,23),(3,10,15,20,30);
SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25;
} {1}
do_rtree_integrity_test rtreeG-1.2.integrity t1
do_test rtreeG-1.2log {
set ::log
} {}
db close
sqlite3 db test.db
do_execsql_test rtreeG-1.3 {
SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25;
} {1}
do_test rtreeG-1.3log {
set ::log
} {}
do_execsql_test rtreeG-1.4 {
DROP TABLE t1;
} {}
do_test rtreeG-1.4log {
set ::log
} {}
expand_all_sql db
db close
sqlite3_shutdown
test_sqlite3_log
sqlite3_initialize
sqlite3 db test.db
finish_test