public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: ankur.tyagi85@gmail.com
To: openembedded-core@lists.openembedded.org
Cc: Ankur Tyagi <ankur.tyagi85@gmail.com>
Subject: [OE-core][whinlatter][PATCH v2 29/29] sqlite3: patch CVE-2025-6965
Date: Fri, 19 Dec 2025 08:52:08 +0530	[thread overview]
Message-ID: <20251219032209.960840-30-ankur.tyagi85@gmail.com> (raw)
In-Reply-To: <20251219032209.960840-1-ankur.tyagi85@gmail.com>

From: Ankur Tyagi <ankur.tyagi85@gmail.com>

Details https://nvd.nist.gov/vuln/detail/CVE-2025-6965

Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
---
 .../sqlite/files/CVE-2025-6965.patch          | 117 ++++++++++++++++++
 meta/recipes-support/sqlite/sqlite3_3.48.0.bb |   1 +
 2 files changed, 118 insertions(+)
 create mode 100644 meta/recipes-support/sqlite/files/CVE-2025-6965.patch

diff --git a/meta/recipes-support/sqlite/files/CVE-2025-6965.patch b/meta/recipes-support/sqlite/files/CVE-2025-6965.patch
new file mode 100644
index 0000000000..510155dc27
--- /dev/null
+++ b/meta/recipes-support/sqlite/files/CVE-2025-6965.patch
@@ -0,0 +1,117 @@
+From a96cef81fdb28deada1e788d4b8248c8d5db9854 Mon Sep 17 00:00:00 2001
+From: Ankur Tyagi <ankur.tyagi85@gmail.com>
+Date: Fri, 19 Dec 2025 00:11:46 +0530
+Subject: [PATCH] Raise an error right away if the number of aggregate terms in
+ a query exceeds the maximum number of columns.
+
+FossilOrigin-Name: 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8
+
+Macro SMXV and UMXV were introduced by following commit:
+https://github.com/sqlite/sqlite/commit/ef86b942b9ffbfc2086da7865effea3e7950c7a0#diff-1c98d9decb23a7ef76f550fa8bced43ea6267338174cef9465d1b990ac3fb80e
+
+CVE: CVE-2025-6965
+Upstream-Status: Backport [https://github.com/sqlite/sqlite/commit/c52e9d97d485a3eb168e3f8f3674a7bc4b419703]
+
+Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
+---
+ sqlite3.c | 31 +++++++++++++++++++++++++++----
+ 1 file changed, 27 insertions(+), 4 deletions(-)
+
+diff --git a/sqlite3.c b/sqlite3.c
+index 8a43734131..98d8106d6a 100644
+--- a/sqlite3.c
++++ b/sqlite3.c
+@@ -15257,6 +15257,14 @@ typedef INT16_TYPE LogEst;
+ #define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32))
+ #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
+ 
++/*
++** Macro SMXV(n) return the maximum value that can be held in variable n,
++** assuming n is a signed integer type.  UMXV(n) is similar for unsigned
++** integer types.
++*/
++#define SMXV(n) ((((i64)1)<<(sizeof(n)*8-1))-1)
++#define UMXV(n) ((((i64)1)<<(sizeof(n)*8))-1)
++
+ /*
+ ** Round up a number to the next larger multiple of 8.  This is used
+ ** to force 8-byte alignment on 64-bit architectures.
+@@ -19046,7 +19054,7 @@ struct AggInfo {
+                           ** from source tables rather than from accumulators */
+   u8 useSortingIdx;       /* In direct mode, reference the sorting index rather
+                           ** than the source table */
+-  u16 nSortingColumn;     /* Number of columns in the sorting index */
++  u32 nSortingColumn;     /* Number of columns in the sorting index */
+   int sortingIdx;         /* Cursor number of the sorting index */
+   int sortingIdxPTab;     /* Cursor number of pseudo-table */
+   int iFirstReg;          /* First register in range for aCol[] and aFunc[] */
+@@ -19055,8 +19063,8 @@ struct AggInfo {
+     Table *pTab;             /* Source table */
+     Expr *pCExpr;            /* The original expression */
+     int iTable;              /* Cursor number of the source table */
+-    i16 iColumn;             /* Column number within the source table */
+-    i16 iSorterColumn;       /* Column number in the sorting index */
++    int iColumn;             /* Column number within the source table */
++    int iSorterColumn;       /* Column number in the sorting index */
+   } *aCol;
+   int nColumn;            /* Number of used entries in aCol[] */
+   int nAccumulator;       /* Number of columns that show through to the output.
+@@ -116445,7 +116453,9 @@ static void findOrCreateAggInfoColumn(
+ ){
+   struct AggInfo_col *pCol;
+   int k;
++  int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN];
+ 
++  assert( mxTerm <= SMXV(i16) );
+   assert( pAggInfo->iFirstReg==0 );
+   pCol = pAggInfo->aCol;
+   for(k=0; k<pAggInfo->nColumn; k++, pCol++){
+@@ -116463,6 +116473,11 @@ static void findOrCreateAggInfoColumn(
+     assert( pParse->db->mallocFailed );
+     return;
+   }
++
++  if( k>mxTerm ){
++    sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm);
++    k = mxTerm;
++  }
+   pCol = &pAggInfo->aCol[k];
+   assert( ExprUseYTab(pExpr) );
+   pCol->pTab = pExpr->y.pTab;
+@@ -116496,6 +116511,7 @@ fix_up_expr:
+   if( pExpr->op==TK_COLUMN ){
+     pExpr->op = TK_AGG_COLUMN;
+   }
++  assert( k <= SMXV(pExpr->iAgg) );
+   pExpr->iAgg = (i16)k;
+ }
+ 
+@@ -116580,13 +116596,19 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
+         ** function that is already in the pAggInfo structure
+         */
+         struct AggInfo_func *pItem = pAggInfo->aFunc;
++        int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN];
++        assert( mxTerm <= SMXV(i16) );
+         for(i=0; i<pAggInfo->nFunc; i++, pItem++){
+           if( NEVER(pItem->pFExpr==pExpr) ) break;
+           if( sqlite3ExprCompare(0, pItem->pFExpr, pExpr, -1)==0 ){
+             break;
+           }
+         }
+-        if( i>=pAggInfo->nFunc ){
++        if( i>mxTerm ){
++          sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm);
++          i = mxTerm;
++          assert( i<pAggInfo->nFunc );
++        }else if( i>=pAggInfo->nFunc ){
+           /* pExpr is original.  Make a new entry in pAggInfo->aFunc[]
+           */
+           u8 enc = ENC(pParse->db);
+@@ -116640,6 +116662,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
+         */
+         assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );
+         ExprSetVVAProperty(pExpr, EP_NoReduce);
++        assert( i <= SMXV(pExpr->iAgg) );
+         pExpr->iAgg = (i16)i;
+         pExpr->pAggInfo = pAggInfo;
+         return WRC_Prune;
diff --git a/meta/recipes-support/sqlite/sqlite3_3.48.0.bb b/meta/recipes-support/sqlite/sqlite3_3.48.0.bb
index 4988231a0c..c9ff062255 100644
--- a/meta/recipes-support/sqlite/sqlite3_3.48.0.bb
+++ b/meta/recipes-support/sqlite/sqlite3_3.48.0.bb
@@ -5,6 +5,7 @@ LIC_FILES_CHKSUM = "file://sqlite3.h;endline=11;md5=786d3dc581eff03f4fd9e4a77ed0
 
 SRC_URI = "http://www.sqlite.org/2025/sqlite-autoconf-${SQLITE_PV}.tar.gz \
            file://CVE-2025-3277.patch \
+           file://CVE-2025-6965.patch \
 "
 SRC_URI[sha256sum] = "ac992f7fca3989de7ed1fe99c16363f848794c8c32a158dafd4eb927a2e02fd5"
 


      parent reply	other threads:[~2025-12-19  3:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19  3:21 [OE-core][whinlatter][PATCH v2 00/29] Updates for Whinlatter ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 01/29] libxmlb: upgrade 0.3.23 -> 0.3.24 ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 02/29] libarchive: upgrade 3.8.2 -> 3.8.3 ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 03/29] glib-2.0: Upgrade 2.86.0 -> 2.86.1 ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 04/29] ell: upgrade 0.79 -> 0.80 ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 05/29] spirv-llvm-translator: Upgrade to 21.1.2 ankur.tyagi85
2025-12-29 17:32   ` Steve Sakoman
2025-12-29 17:49     ` Khem Raj
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 06/29] gst-devtools: upgrade 1.26.5 -> 1.26.7 ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 07/29] gst-examples: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 08/29] gstreamer1.0-libav: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 09/29] gstreamer1.0-plugins-bad: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 10/29] gstreamer1.0-plugins-base: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 11/29] gstreamer1.0-plugins-good: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 12/29] gstreamer1.0-plugins-ugly: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 13/29] gstreamer1.0-python: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 14/29] gstreamer1.0-rtsp-server: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 15/29] gstreamer1.0: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 16/29] gstreamer1.0-vaapi: " ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 17/29] go: upgrade 1.25.4 -> 1.25.5 ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 18/29] enchant2: upgrade 2.8.12 -> 2.8.14 ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 19/29] libpng: upgrade 1.6.50 -> 1.6.51 ankur.tyagi85
2025-12-19  3:21 ` [OE-core][whinlatter][PATCH v2 20/29] llvm/clang: Upgrade to 21.1.6 release ankur.tyagi85
2025-12-19  3:22 ` [OE-core][whinlatter][PATCH v2 21/29] llvm/clang: Upgrade to 21.1.7 release ankur.tyagi85
2025-12-29 20:34   ` Steve Sakoman
2025-12-29 20:41     ` Khem Raj
2025-12-19  3:22 ` [OE-core][whinlatter][PATCH v2 22/29] mesa: upgrade 25.2.5 -> 25.2.8 ankur.tyagi85
2025-12-19  3:22 ` [OE-core][whinlatter][PATCH v2 23/29] e2fsprogs: misc/create_inode.c: Fix for file larger than 2GB ankur.tyagi85
2025-12-19  3:22 ` [OE-core][whinlatter][PATCH v2 24/29] ccache: upgrade 4.12 -> 4.12.1 ankur.tyagi85
2025-12-19  3:22 ` [OE-core][whinlatter][PATCH v2 25/29] ccache: 4.12.1 -> 4.12.2 ankur.tyagi85
2025-12-19  3:22 ` [OE-core][whinlatter][PATCH v2 26/29] gnutls: patch CVE-2025-9820 ankur.tyagi85
2025-12-19  3:22 ` [OE-core][whinlatter][PATCH v2 27/29] cups: upgrade from 2.4.14 to 2.4.15 ankur.tyagi85
2025-12-19  3:22 ` [OE-core][whinlatter][PATCH v2 28/29] sqlite3: patch CVE-2025-3277 ankur.tyagi85
2025-12-19  3:22 ` ankur.tyagi85 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251219032209.960840-30-ankur.tyagi85@gmail.com \
    --to=ankur.tyagi85@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox