]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
When doing a test-to-double conversion on a BLOB with an odd number of bytes
authordrh <drh@noemail.net>
Wed, 8 Jan 2020 12:17:46 +0000 (12:17 +0000)
committerdrh <drh@noemail.net>
Wed, 8 Jan 2020 12:17:46 +0000 (12:17 +0000)
and assuming a UTF16 encoding, ignore the last byte.
Ticket [9eda2697f5cc1aba].

FossilOrigin-Name: 1c76f1d8ec0937a2d2e4ce75f98494c953e9621db31945d7e44f45d90d1c3892

manifest
manifest.uuid
src/util.c
test/atof1.test

index 9950bda48bddf068b27fab75677fad13cb9ae576..f4dd7639e2cd2d23b2f96e4b47f891f63646937a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sminor\sformatting\serror\sin\sthe\sdisplay\sof\sBLOB\svalues\sduring\sVDBE\ntracing.
-D 2020-01-08T11:36:30.537
+C When\sdoing\sa\stest-to-double\sconversion\son\sa\sBLOB\swith\san\sodd\snumber\sof\sbytes\nand\sassuming\sa\sUTF16\sencoding,\signore\sthe\slast\sbyte.\nTicket\s[9eda2697f5cc1aba].
+D 2020-01-08T12:17:46.451
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -598,7 +598,7 @@ F src/trigger.c a40d50e88bd3355f1d2a73f0a3b2d6b42eae26ca4219001b82ef0d064439badc
 F src/update.c 9ad19af96aff95dc02a923a99f97c1bc0b909009a29a2914b796f786b9ac0c60
 F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
 F src/utf.c 736ff76753236ffbc8b5b939f5e0607f28aeaa7c780b3a56b419228f0a81c87b
-F src/util.c 2c92bc706bbdb1c45a25180291e7e05a56e297aa5dd7b2bcd2b1c47e8bb05b17
+F src/util.c e5f3971160154e5c9b660fd119b02ec4890e87cd18a5bc4d45ee60cddbb9e6a2
 F src/vacuum.c 82dcec9e7b1afa980288718ad11bc499651c722d7b9f32933c4d694d91cb6ebf
 F src/vdbe.c 35dcc7d43c2635853773d994b052061283a4e5b0e60e799cef83e410d90f3145
 F src/vdbe.h defd693289c7bb8d325f109be9490c77138061211a116827da7244b6015a4934
@@ -658,7 +658,7 @@ F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b
 F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7
 F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a
 F test/async5.test 383ab533fdb9f7ad228cc99ee66e1acb34cc0dc0
-F test/atof1.test ff0b0156fd705b67c506e1f2bfe9e26102bea9bd
+F test/atof1.test 1ccfc96a6888566597b83d882c81b3c04258dc39317e8c1cec89ba481eaa2fba
 F test/atomic.test 065a453dde33c77ff586d91ccaa6ed419829d492dbb1a5694b8a09f3f9d7d061
 F test/atomic2.test b6863b4aa552543874f80b42fb3063f1c8c2e3d8e56b6562f00a3cc347b5c1da
 F test/atrc.c ec92d56d8fbed9eb3e11aaf1ab98cf7dd59e69dae31f128013f1d97e54e7dfed
@@ -1853,7 +1853,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P fa866aec56deca8cc1b70814215bbdc683f41bc0826da0f8804d952de429820c
-R 17d7c20026c82c44945aa08b93d68dfb
+P 295442887a3cd5868df26c5be244649ffb3bae8367f5cf02fe513424a1c9f6a7
+R 9275f44076e39841a96fb22faa964c5a
 U drh
-Z 1e5efc8d32a46b031eabd796b5d1581a
+Z ac500ac229baf04846641aa2e74b4140
index 28c8823c256eead3e5907cb3957de143c23ae96d..a31a5968eb0980872d23678a425e0cafc47a3edd 100644 (file)
@@ -1 +1 @@
-295442887a3cd5868df26c5be244649ffb3bae8367f5cf02fe513424a1c9f6a7
\ No newline at end of file
+1c76f1d8ec0937a2d2e4ce75f98494c953e9621db31945d7e44f45d90d1c3892
\ No newline at end of file
index f7a993a766e0105654cf371c158786428ecb8b36..88ac6d39f8803cb160a41420cd94f526ea9ffd2f 100644 (file)
@@ -411,6 +411,7 @@ int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){
   }else{
     int i;
     incr = 2;
+    length &= ~1;
     assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
     testcase( enc==SQLITE_UTF16LE );
     testcase( enc==SQLITE_UTF16BE );
index 55f5e44d960d81f6266f0b328677d613fbf86097..34e69c12f8c073841a1635b6ad07943a83556310 100644 (file)
@@ -56,5 +56,29 @@ for {set i 1} {$i<20000} {incr i} {
   } {1}
 }
 
+# 2020-01-08 ticket 9eda2697f5cc1aba
+# When running sqlite3AtoF() on a blob with an odd number of bytes using
+# UTF16, ignore the last byte so that the string has an integer number of
+# UTF16 code points.
+#
+reset_db
+do_execsql_test atof1-2.10 {
+  PRAGMA encoding = 'UTF16be';
+  CREATE TABLE t1(a, b);
+  INSERT INTO t1(rowid,a) VALUES (1,x'00'),(2,3);
+  SELECT substr(a,',') is true FROM t1 ORDER BY rowid;
+} {0 1}
+do_execsql_test atof1-2.20 {
+  SELECT substr(a,',') is true FROM t1 ORDER BY rowid DESC;
+} {1 0}
+do_execsql_test atof1-2.30 {
+  CREATE INDEX i1 ON t1(a);
+  SELECT count(*) FROM t1 WHERE substr(a,',');
+} {1}
+
+
+
+
+
 
 finish_test