Blame SOURCES/sqlite-3.26.0-CVE-2019-19925.patch

094f44
From 1986c6384122947b10804cbc5c4d7af85e097404 Mon Sep 17 00:00:00 2001
094f44
From: Ondrej Dubaj <odubaj@redhat.com>
094f44
Date: Mon, 20 Jan 2020 10:09:55 +0100
094f44
Subject: [PATCH] Fix the zipfile extension so that INSERT works even if the
094f44
 pathname of
094f44
094f44
the file being inserted is a NULL.  Bug discovered by the
094f44
Yongheng and Rui fuzzer.
094f44
---
094f44
 ext/misc/zipfile.c |  1 +
094f44
 test/zipfile.test  | 13 +++++++++++++
094f44
 2 files changed, 14 insertions(+)
094f44
094f44
diff --git a/ext/misc/zipfile.c b/ext/misc/zipfile.c
094f44
index e57dc38..6f48d0f 100644
094f44
--- a/ext/misc/zipfile.c
094f44
+++ b/ext/misc/zipfile.c
094f44
@@ -1618,6 +1618,7 @@ static int zipfileUpdate(
094f44
 
094f44
     if( rc==SQLITE_OK ){
094f44
       zPath = (const char*)sqlite3_value_text(apVal[2]);
094f44
+      if( zPath==0 ) zPath = "";
094f44
       nPath = (int)strlen(zPath);
094f44
       mTime = zipfileGetTime(apVal[4]);
094f44
     }
094f44
diff --git a/test/zipfile.test b/test/zipfile.test
094f44
index 2bab066..5bca10b 100644
094f44
--- a/test/zipfile.test
094f44
+++ b/test/zipfile.test
094f44
@@ -795,4 +795,17 @@ if {$tcl_platform(platform)!="windows"} {
094f44
   } {. ./x1.txt ./x2.txt}
094f44
 }
094f44
 
094f44
+# 2019-12-18 Yongheng and Rui fuzzer
094f44
+#
094f44
+do_execsql_test 13.10 {
094f44
+  DROP TABLE IF EXISTS t0;
094f44
+  DROP TABLE IF EXISTS t1;
094f44
+  CREATE TABLE t0(a,b,c,d,e,f,g);
094f44
+  REPLACE INTO t0(c,b,f) VALUES(10,10,10);
094f44
+  CREATE VIRTUAL TABLE t1 USING zipfile('h.zip');
094f44
+  REPLACE INTO t1 SELECT * FROM t0;
094f44
+  SELECT quote(name),quote(mode),quote(mtime),quote(sz),quote(rawdata),
094f44
+         quote(data),quote(method) FROM t1;
094f44
+} {'' 10 10 2 X'3130' X'3130' 0}
094f44
+
094f44
 finish_test
094f44
-- 
094f44
2.19.1
094f44