1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

When doing a test-to-double conversion on a BLOB with an odd number of bytes

and assuming a UTF16 encoding, ignore the last byte.
Ticket [9eda2697f5cc1aba].

FossilOrigin-Name: 1c76f1d8ec0937a2d2e4ce75f98494c953e9621db31945d7e44f45d90d1c3892
This commit is contained in:
drh
2020-01-08 12:17:46 +00:00
parent ded33ccea4
commit 87969b2a11
4 changed files with 33 additions and 8 deletions

View 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