sqlite/0005-uninitialized-value-used-in-pattern-compare.patch

29 lines
1.1 KiB
Diff
Raw Normal View History

diff -Nur sqlite_before/src/func.c sqlite_after/src/func.c
--- sqlite_before/src/func.c 2021-09-26 16:11:20.573041810 +0800
+++ sqlite_after/src/func.c 2021-09-26 16:16:56.535137866 +0800
@@ -694,7 +694,8 @@
/* Skip over multiple "*" characters in the pattern. If there
** are also "?" characters, skip those as well, but consume a
** single character of the input string for each "?" skipped */
- while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){
+ while( (c=Utf8Read(zPattern)) == matchAll
+ || (c == matchOne && matchOne!=0) ){
if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
return SQLITE_NOWILDCARDMATCH;
}
diff -Nur sqlite_before/test/like.test sqlite_after/test/like.test
--- sqlite_before/test/like.test 2021-09-26 16:11:20.561041592 +0800
+++ sqlite_after/test/like.test 2021-09-26 16:17:03.575265610 +0800
@@ -1131,4 +1131,11 @@
SELECT id FROM t1 WHERE x LIKE 'abc__' ESCAPE '_';
} {2}
+# 2021-02-15 ticket c0aeea67d58ae0fd
+#
+do_execsql_test 17.1 {
+ SELECT 'x' LIKE '%' ESCAPE '_';
+} {1}
+
+
finish_test