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

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