diff options
author | drh <drh@noemail.net> | 2007-06-07 19:08:32 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-06-07 19:08:32 +0000 |
commit | 98640a3fa16a0501fe4251b144f46ad01651be89 (patch) | |
tree | 7cfb05df94b78e5eef22372f07c7ea812cf0e392 /test/zeroblob.test | |
parent | 6c900c3df7062c4f7523ca8330b062fa77d67a9a (diff) | |
download | sqlite-98640a3fa16a0501fe4251b144f46ad01651be89.tar.gz sqlite-98640a3fa16a0501fe4251b144f46ad01651be89.zip |
Make sure zeroblob does reasonable things with a negative argument or
an argument that is larger than the maximum blob size. (CVS 4048)
FossilOrigin-Name: f40218434e549144ddb48303df30e5191d44d3fc
Diffstat (limited to 'test/zeroblob.test')
-rw-r--r-- | test/zeroblob.test | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/zeroblob.test b/test/zeroblob.test index 2960316fd..802927559 100644 --- a/test/zeroblob.test +++ b/test/zeroblob.test @@ -13,7 +13,7 @@ # including the sqlite3_bind_zeroblob(), sqlite3_result_zeroblob(), # and the built-in zeroblob() SQL function. # -# $Id: zeroblob.test,v 1.5 2007/05/30 06:19:33 danielk1977 Exp $ +# $Id: zeroblob.test,v 1.6 2007/06/07 19:08:34 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -152,4 +152,28 @@ do_test zeroblob-5.4 { } [execsql {SELECT zeroblob(100)}] +# Check for malicious use of zeroblob. Make sure nothing crashes. +# +do_test zeroblob-6.1.1 { + execsql {select zeroblob(-1)} +} {{}} +do_test zeroblob-6.1.2 { + execsql {select zeroblob(-10)} +} {{}} +do_test zeroblob-6.1.3 { + execsql {select zeroblob(-100)} +} {{}} +do_test zeroblob-6.2 { + execsql {select length(zeroblob(-1))} +} {0} +do_test zeroblob-6.3 { + execsql {select zeroblob(-1)|1} +} {1} +do_test zeroblob-6.4 { + catchsql {select length(zeroblob(2147483648))} +} {1 {string or blob too big}} +do_test zeroblob-6.5 { + catchsql {select zeroblob(2147483648)} +} {1 {string or blob too big}} + finish_test |