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

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