fix the uninitialized value used in pattern match

Signed-off-by: wbq_sky <wangbingquan@huawei.com>
This commit is contained in:
wbq_sky 2021-09-26 16:28:27 +08:00
parent 80491f4558
commit c7b6d9b65f
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,28 @@
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

View File

@ -6,7 +6,7 @@
Name: sqlite
Version: 3.34.0
Release: 3
Release: 4
Summary: Embeded SQL database
License: Public Domain
URL: http://www.sqlite.org/
@ -19,6 +19,7 @@ Patch1: 0001-sqlite-no-malloc-usable-size.patch
Patch2: 0002-remove-fail-testcase-in-no-free-fd-situation.patch
Patch3: 0003-infinite-loop-in-trim-function.patch
Patch4: 0004-null-ref-in-trigger.patch
Patch5: 0005-uninitialized-value-used-in-pattern-compare.patch
BuildRequires: gcc autoconf tcl tcl-devel
BuildRequires: ncurses-devel readline-devel glibc-devel
@ -65,6 +66,7 @@ This contains man files and HTML files for the using of sqlite.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
rm -f %{name}-doc-%{extver}/sqlite.css~ || :
@ -135,6 +137,9 @@ make test
%{_mandir}/man*/*
%changelog
* Fri Sep 26 2021 wbq_sky <wangbingquan@huawei.com> - 3.34.0-4
- fix the uninitialized value used in pattern match.
* Fri Sep 3 2021 wbq_sky <wangbingquan@huawei.com> - 3.34.0-3
- fix the null reference in the tigger statement.