diff --git a/manifest b/manifest index 47e9e66a89..6ee6171401 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\spParse->rc\sgets\sset\swhenever\ssqlite3ErrorMsg()\sis\scalled.\s\sThis\sis\nadded\sinsurance\sthat\sparsing\swill\sstop\squickly\safter\san\serror.\s\sThis\schange\ndid\smake\sthe\sparser\sstop\sfaster\sin\ssome\scases,\swhich\srequired\ssome\srevisions\nto\stests.\s(CVS\s4010) -D 2007-05-15T16:51:37 +C Additional\stests\sfor\smalformed\sUTF-8.\s(CVS\s4011) +D 2007-05-15T18:35:21 F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -164,6 +164,7 @@ F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31 F test/autovacuum_ioerr.test c46a76869cb6eddbbb40b419b2b6c4c001766b1f F test/autovacuum_ioerr2.test dc189f323cf0546289b5a9bbda60bcb1fe52bd4b F test/avtrans.test b77740800de0d2cdcf394ef94d2d61225a1941d8 +F test/badutf.test e5cd3fd946b76fb0d05024156618ed905298f44a F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070 F test/bigfile.test ebc9ce9216e08bead63734ab816d0f27858f3b80 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747 @@ -247,7 +248,7 @@ F test/fts2k.test 222d0b3bc8667753f18406aaea9906a6098ea016 F test/fts2l.test 4c53c89ce3919003765ff4fd8d98ecf724d97dd3 F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51 F test/fts2n.test a70357e72742681eaebfdbe9007b87ff3b771638 -F test/func.test bf30bac1c5ce10448ab739994268cf18f8b3fa30 +F test/func.test 605989453d1b42cec1d05c17aa232dc98e3e04e6 F test/fuzz.test 3d382b2d3c6b909a4f08b46dc6ca6a149eeb3a81 F test/fuzz2.test ea38692ce2da99ad79fe0be5eb1a452c1c4d37bb F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a @@ -491,7 +492,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 9b91502ef0ea9c0bfb8362c4b70314dc8449eb9e -R 05f932c99108ea2fd9e2cf63bbb5a075 +P f84d9dab110c4415d9b772f8043397640162b6b2 +R 53fa1bf671cabc8be454726443bd9326 U drh -Z 9a27c4d77fa449acc8811ad8c3119491 +Z 08fe10d1e019c102afe7db67bcfd77dd diff --git a/manifest.uuid b/manifest.uuid index 9b408f13e9..13fa24868b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f84d9dab110c4415d9b772f8043397640162b6b2 \ No newline at end of file +448d3ef670dce6d27c7d7b1be58088d45f8b6274 \ No newline at end of file diff --git a/test/badutf.test b/test/badutf.test new file mode 100644 index 0000000000..130e772de7 --- /dev/null +++ b/test/badutf.test @@ -0,0 +1,139 @@ +# 2007 May 15 +# +# 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 implements regression tests for SQLite library. +# +# This file checks to make sure SQLite is able to gracefully +# handle malformed UTF-8. +# +# $Id: badutf.test,v 1.1 2007/05/15 18:35:21 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_test badutf-1.1 { + db eval {PRAGMA encoding=UTF8} + sqlite3_exec db {SELECT hex('%80') AS x} +} {0 {x 80}} +do_test badutf-1.2 { + sqlite3_exec db {SELECT hex('%81') AS x} +} {0 {x 81}} +do_test badutf-1.3 { + sqlite3_exec db {SELECT hex('%bf') AS x} +} {0 {x BF}} +do_test badutf-1.4 { + sqlite3_exec db {SELECT hex('%c0') AS x} +} {0 {x C0}} +do_test badutf-1.5 { + sqlite3_exec db {SELECT hex('%e0') AS x} +} {0 {x E0}} +do_test badutf-1.6 { + sqlite3_exec db {SELECT hex('%f0') AS x} +} {0 {x F0}} +do_test badutf-1.7 { + sqlite3_exec db {SELECT hex('%ff') AS x} +} {0 {x FF}} + +do_test badutf-1.10 { + sqlite3 db2 {} + db2 eval {PRAGMA encoding=UTF16be} + sqlite3_exec db2 {SELECT hex('%80') AS x} +} {0 {x 0080}} +do_test badutf-1.11 { + sqlite3_exec db2 {SELECT hex('%81') AS x} +} {0 {x 0081}} +do_test badutf-1.12 { + sqlite3_exec db2 {SELECT hex('%bf') AS x} +} {0 {x 00BF}} +do_test badutf-1.13 { + sqlite3_exec db2 {SELECT hex('%c0') AS x} +} {0 {x FFFD}} +do_test badutf-1.14 { + sqlite3_exec db2 {SELECT hex('%c1') AS x} +} {0 {x FFFD}} +do_test badutf-1.15 { + sqlite3_exec db2 {SELECT hex('%c0%bf') AS x} +} {0 {x FFFD}} +do_test badutf-1.16 { + sqlite3_exec db2 {SELECT hex('%c1%bf') AS x} +} {0 {x FFFD}} +do_test badutf-1.17 { + sqlite3_exec db2 {SELECT hex('%c3%bf') AS x} +} {0 {x 00FF}} +do_test badutf-1.18 { + sqlite3_exec db2 {SELECT hex('%e0') AS x} +} {0 {x FFFD}} +do_test badutf-1.19 { + sqlite3_exec db2 {SELECT hex('%f0') AS x} +} {0 {x FFFD}} +do_test badutf-1.20 { + sqlite3_exec db2 {SELECT hex('%ff') AS x} +} {0 {x FFFD}} + + +do_test badutf-2.1 { + sqlite3_exec db {SELECT '%80'=CAST(x'80' AS text) AS x} +} {0 {x 1}} +do_test badutf-2.2 { + sqlite3_exec db {SELECT CAST('%80' AS blob)=x'80' AS x} +} {0 {x 1}} + +do_test badutf-3.1 { + sqlite3_exec db {SELECT length('%80') AS x} +} {0 {x 1}} +do_test badutf-3.2 { + sqlite3_exec db {SELECT length('%61%62%63') AS x} +} {0 {x 3}} +do_test badutf-3.3 { + sqlite3_exec db {SELECT length('%7f%80%81') AS x} +} {0 {x 3}} +do_test badutf-3.4 { + sqlite3_exec db {SELECT length('%61%c0') AS x} +} {0 {x 2}} +do_test badutf-3.5 { + sqlite3_exec db {SELECT length('%61%c0%80%80%80%80%80%80%80%80%80%80') AS x} +} {0 {x 2}} +do_test badutf-3.6 { + sqlite3_exec db {SELECT length('%c0%80%80%80%80%80%80%80%80%80%80') AS x} +} {0 {x 1}} +do_test badutf-3.7 { + sqlite3_exec db {SELECT length('%80%80%80%80%80%80%80%80%80%80') AS x} +} {0 {x 10}} +do_test badutf-3.8 { + sqlite3_exec db {SELECT length('%80%80%80%80%80%f0%80%80%80%80') AS x} +} {0 {x 6}} +do_test badutf-3.9 { + sqlite3_exec db {SELECT length('%80%80%80%80%80%f0%80%80%80%ff') AS x} +} {0 {x 7}} + +do_test badutf-4.1 { + sqlite3_exec db {SELECT hex(trim('%80%80%80%f0%80%80%80%ff','%80%ff')) AS x} +} {0 {x F0}} +do_test badutf-4.2 { + sqlite3_exec db {SELECT hex(ltrim('%80%80%80%f0%80%80%80%ff','%80%ff')) AS x} +} {0 {x F0808080FF}} +do_test badutf-4.3 { + sqlite3_exec db {SELECT hex(rtrim('%80%80%80%f0%80%80%80%ff','%80%ff')) AS x} +} {0 {x 808080F0}} +do_test badutf-4.4 { + sqlite3_exec db {SELECT hex(trim('%80%80%80%f0%80%80%80%ff','%ff%80')) AS x} +} {0 {x 808080F0808080FF}} +do_test badutf-4.5 { + sqlite3_exec db {SELECT hex(trim('%ff%80%80%f0%80%80%80%ff','%ff%80')) AS x} +} {0 {x 80F0808080FF}} +do_test badutf-4.6 { + sqlite3_exec db {SELECT hex(trim('%ff%80%f0%80%80%80%ff','%ff%80')) AS x} +} {0 {x F0808080FF}} +do_test badutf-4.7 { + sqlite3_exec db {SELECT hex(trim('%ff%80%f0%80%80%80%ff','%ff%80%80')) AS x} +} {0 {x FF80F0808080FF}} + +db2 close +finish_test diff --git a/test/func.test b/test/func.test index a9fb12e0a6..a5774d8130 100644 --- a/test/func.test +++ b/test/func.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing built-in functions. # -# $Id: func.test,v 1.66 2007/05/11 01:44:52 drh Exp $ +# $Id: func.test,v 1.67 2007/05/15 18:35:21 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -327,17 +327,31 @@ do_test func-9.5 { do_test func-9.10 { execsql {SELECT hex(x'00112233445566778899aAbBcCdDeEfF')} } {00112233445566778899AABBCCDDEEFF} -do_test func-9.11 { - execsql {SELECT hex(replace('abcdefg','ef','12'))} -} {61626364313267} -do_test func-9.12 { - execsql {SELECT hex(replace('abcdefg','','12'))} -} {{}} -breakpoint -do_test func-9.13 { - execsql {SELECT hex(replace('aabcdefg','a','aaa'))} -} {616161616161626364656667} - +set encoding [db one {PRAGMA encoding}] +if {$encoding=="UTF-16le"} { + do_test func-9.11-utf16le { + execsql {SELECT hex(replace('abcdefg','ef','12'))} + } {6100620063006400310032006700} + do_test func-9.12-utf16le { + execsql {SELECT hex(replace('abcdefg','','12'))} + } {{}} + breakpoint + do_test func-9.13-utf16le { + execsql {SELECT hex(replace('aabcdefg','a','aaa'))} + } {610061006100610061006100620063006400650066006700} +} elseif {$encoding=="UTF-8"} { + do_test func-9.11-utf8 { + execsql {SELECT hex(replace('abcdefg','ef','12'))} + } {61626364313267} + do_test func-9.12-utf8 { + execsql {SELECT hex(replace('abcdefg','','12'))} + } {{}} + breakpoint + do_test func-9.13-utf8 { + execsql {SELECT hex(replace('aabcdefg','a','aaa'))} + } {616161616161626364656667} +} + # Use the "sqlite_register_test_function" TCL command which is part of # the text fixture in order to verify correct operation of some of # the user-defined SQL function APIs that are not used by the built-in