]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
sqlite3: Backport fix for CVE-2023-7104
authorVijay Anusuri <vanusuri@mvista.com>
Fri, 19 Jan 2024 02:25:24 +0000 (07:55 +0530)
committerSteve Sakoman <steve@sakoman.com>
Mon, 22 Jan 2024 13:35:47 +0000 (03:35 -1000)
Backport https://sqlite.org/src/info/0e4e7a05c4204b47

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-support/sqlite/files/CVE-2023-7104.patch [new file with mode: 0644]
meta/recipes-support/sqlite/sqlite3_3.31.1.bb

diff --git a/meta/recipes-support/sqlite/files/CVE-2023-7104.patch b/meta/recipes-support/sqlite/files/CVE-2023-7104.patch
new file mode 100644 (file)
index 0000000..01ff29f
--- /dev/null
@@ -0,0 +1,46 @@
+From eab426c5fba69d2c77023939f72b4ad446834e3c Mon Sep 17 00:00:00 2001
+From: dan <Dan Kennedy>
+Date: Thu, 7 Sep 2023 13:53:09 +0000
+Subject: [PATCH] Fix a buffer overread in the sessions extension that could occur when processing a corrupt changeset.
+
+Upstream-Status: Backport [https://sqlite.org/src/info/0e4e7a05c4204b47]
+CVE: CVE-2023-7104
+Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
+---
+ sqlite3.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/sqlite3.c b/sqlite3.c
+index 972ef18..c645ac8 100644
+--- a/sqlite3.c
++++ b/sqlite3.c
+@@ -203301,15 +203301,19 @@ static int sessionReadRecord(
+         }
+       }
+       if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
+-        sqlite3_int64 v = sessionGetI64(aVal);
+-        if( eType==SQLITE_INTEGER ){
+-          sqlite3VdbeMemSetInt64(apOut[i], v);
++      if( (pIn->nData-pIn->iNext)<8 ){
++        rc = SQLITE_CORRUPT_BKPT;
+         }else{
+-          double d;
+-          memcpy(&d, &v, 8);
+-          sqlite3VdbeMemSetDouble(apOut[i], d);
++        sqlite3_int64 v = sessionGetI64(aVal);
++        if( eType==SQLITE_INTEGER ){
++          sqlite3VdbeMemSetInt64(apOut[i], v);
++        }else{
++          double d;
++          memcpy(&d, &v, 8);
++          sqlite3VdbeMemSetDouble(apOut[i], d);
++        }
++        pIn->iNext += 8;
+         }
+-        pIn->iNext += 8;
+       }
+     }
+   }
+-- 
+2.25.1
+
index ef12ef0db2fbd33de82e334e3042cbd2d37fcff6..0e7bcfa5a7393cfbf564e7894f609bafd6cbd9ad 100644 (file)
@@ -17,6 +17,7 @@ SRC_URI = "http://www.sqlite.org/2020/sqlite-autoconf-${SQLITE_PV}.tar.gz \
            file://CVE-2020-35525.patch \
            file://CVE-2020-35527.patch \
            file://CVE-2021-20223.patch \
+           file://CVE-2023-7104.patch \
            "
 SRC_URI[md5sum] = "2d0a553534c521504e3ac3ad3b90f125"
 SRC_URI[sha256sum] = "62284efebc05a76f909c580ffa5c008a7d22a1287285d68b7825a2b6b51949ae"