Avoid an out-of-bounds read in sqlite3_prepare() and fix a case where the output variable *pzTail was being set incorrectly. Fix for #3027. (CVS 4957)

FossilOrigin-Name: c287a7b29410be12cf88f886e8e2525a42aa9c03
This commit is contained in:
danielk1977
2008-04-03 14:36:25 +00:00
parent ce98bba24b
commit 3a2c8c8b73
8 changed files with 393 additions and 19 deletions
+16 -3
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
# $Id: capi3.test,v 1.61 2008/03/19 13:03:34 drh Exp $
# $Id: capi3.test,v 1.62 2008/04/03 14:36:26 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -74,15 +74,28 @@ do_test capi3-1.4 {
set TAIL
} {SELECT 10}
do_test capi3-1.5 {
set sql {SELECT name FROM sqlite_master;SELECT 10}
set STMT [sqlite3_prepare $DB $sql [string length $sql] TAIL]
sqlite3_finalize $STMT
set TAIL
} {SELECT 10}
do_test capi3-1.6 {
set sql {SELECT name FROM sqlite_master;SELECT 10}
set STMT [sqlite3_prepare $DB $sql [expr [string length $sql]+1] TAIL]
sqlite3_finalize $STMT
set TAIL
} {SELECT 10}
do_test capi3-1.7 {
set sql {SELECT namex FROM sqlite_master}
catch {
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
}
} {1}
do_test capi3-1.6 {
do_test capi3-1.8 {
sqlite3_errcode $DB
} {SQLITE_ERROR}
do_test capi3-1.7 {
do_test capi3-1.9 {
sqlite3_errmsg $DB
} {no such column: namex}