Skip to contentSkip to conversation

sqlite3: fix CVE-2019-9936 and CVE-2019-9937

PATCH New Ross Burton 1 participant 1 message Mar 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sqlite3: fix CVE-2019-9936 and CVE-2019-9937

---
 .../sqlite/sqlite3/CVE-2019-9936.patch             |  28 +++
 .../sqlite/sqlite3/CVE-2019-9937.patch             | 187 +++++++++++++++++++++
 meta/recipes-support/sqlite/sqlite3_3.27.2.bb      |   2 +
 3 files changed, 217 insertions(+)
 create mode 100644 meta/recipes-support/sqlite/sqlite3/CVE-2019-9936.patch
 create mode 100644 meta/recipes-support/sqlite/sqlite3/CVE-2019-9937.patch
meta/recipes-support/sqlite/sqlite3/CVE-2019-9936.patch new file +28 -0
new file mode 100644
index 00000000000..1b907b9d4dd
@@ -0,0 +1,28 @@
+Running fts5 prefix queries inside a transaction could trigger a heap-based
+buffer over-read in fts5HashEntrySort in sqlite3.c, which may lead to an
+information leak.
+
+CVE: CVE-2019-9936
+Upstream-Status: Backport [https://sqlite.org/src/vpatch?from=45c73deb440496e8&to=b3fa58dd7403dbd4]
+Signed-off-by: Ross Burton <[email protected]>
+---
+ sqlite3.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/sqlite3.c b/sqlite3.c
+index 4729f45..65527d8 100644
+--- a/sqlite3.c
++++ b/sqlite3.c
+@@ -207759,7 +207759,9 @@ static int fts5HashEntrySort(
+   for(iSlot=0; iSlot<pHash->nSlot; iSlot++){
+     Fts5HashEntry *pIter;
+     for(pIter=pHash->aSlot[iSlot]; pIter; pIter=pIter->pHashNext){
+-      if( pTerm==0 || 0==memcmp(fts5EntryKey(pIter), pTerm, nTerm) ){
++      if( pTerm==0
++       || (pIter->nKey+1>=nTerm && 0==memcmp(fts5EntryKey(pIter), pTerm, nTerm))
++      ){
+         Fts5HashEntry *pEntry = pIter;
+         pEntry->pScanNext = 0;
+         for(i=0; ap[i]; i++){
+-- 
+2.20.1
meta/recipes-support/sqlite/sqlite3/CVE-2019-9937.patch new file +187 -0

187 lines not on this page · raw message

meta/recipes-support/sqlite/sqlite3_3.27.2.bb +2 -0
index 22fec21454b..4bdb04f4d1f 100644
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://sqlite3.h;endline=11;md5=786d3dc581eff03f4fd9e4a77ed0
 
 SRC_URI = "\
   http://www.sqlite.org/2019/sqlite-autoconf-${SQLITE_PV}.tar.gz \
+  file://CVE-2019-9936.patch \
+  file://CVE-2019-9937.patch \
   "
 
 SRC_URI[md5sum] = "1f72631ce6e8efa5b4a6e55a43b3bdc0"
Signature · 1 line
2.11.0