diff options
author | Peter Marko <peter.marko@siemens.com> | 2025-08-04 18:41:00 +0200 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2025-08-13 08:42:57 -0700 |
commit | 50b9a965514c6026f26ea048ed5f2f8b174f738e (patch) | |
tree | 8b922c170227d2b6c4cbb77bbd068d5e2800b3d5 | |
parent | 49a7cd5a14469b12a132d610f76e86e138e802a7 (diff) | |
download | poky-50b9a965514c6026f26ea048ed5f2f8b174f738e.tar.gz |
sqlite3: patch CVE-2025-6965
Pick patch [1] mentioned in NVD report [2] from github mirror [3].
[1] https://www.sqlite.org/src/info/5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8
[2] https://nvd.nist.gov/vuln/detail/CVE-2025-6965
[3] https://github.com/sqlite/sqlite/commit/c52e9d97d485a3eb168e3f8f3674a7bc4b419703
(From OE-Core rev: de442af2a5a08518e61d0c76484a3099bac6d46d)
Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/recipes-support/sqlite/sqlite3/CVE-2025-6965.patch | 112 | ||||
-rw-r--r-- | meta/recipes-support/sqlite/sqlite3_3.48.0.bb | 1 |
2 files changed, 113 insertions, 0 deletions
diff --git a/meta/recipes-support/sqlite/sqlite3/CVE-2025-6965.patch b/meta/recipes-support/sqlite/sqlite3/CVE-2025-6965.patch new file mode 100644 index 0000000000..9b2f4409b3 --- /dev/null +++ b/meta/recipes-support/sqlite/sqlite3/CVE-2025-6965.patch | |||
@@ -0,0 +1,112 @@ | |||
1 | From c52e9d97d485a3eb168e3f8f3674a7bc4b419703 Mon Sep 17 00:00:00 2001 | ||
2 | From: drh <> | ||
3 | Date: Fri, 27 Jun 2025 19:02:21 +0000 | ||
4 | Subject: [PATCH] Raise an error right away if the number of aggregate terms in | ||
5 | a query exceeds the maximum number of columns. | ||
6 | |||
7 | FossilOrigin-Name: 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8 | ||
8 | |||
9 | CVE: CVE-2025-6965 | ||
10 | Upstream-Status: Backport [https://github.com/sqlite/sqlite/commit/c52e9d97d485a3eb168e3f8f3674a7bc4b419703] | ||
11 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
12 | --- | ||
13 | sqlite3.c | 30 ++++++++++++++++++++++++++---- | ||
14 | 1 file changed, 26 insertions(+), 4 deletions(-) | ||
15 | |||
16 | diff --git a/sqlite3.c b/sqlite3.c | ||
17 | index 146047d..c78f58b 100644 | ||
18 | --- a/sqlite3.c | ||
19 | +++ b/sqlite3.c | ||
20 | @@ -15257,6 +15257,14 @@ typedef INT16_TYPE LogEst; | ||
21 | #define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32)) | ||
22 | #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) | ||
23 | |||
24 | +/* | ||
25 | +** Macro SMXV(n) return the maximum value that can be held in variable n, | ||
26 | +** assuming n is a signed integer type. UMXV(n) is similar for unsigned | ||
27 | +** integer types. | ||
28 | +*/ | ||
29 | +#define SMXV(n) ((((i64)1)<<(sizeof(n)*8-1))-1) | ||
30 | +#define UMXV(n) ((((i64)1)<<(sizeof(n)*8))-1) | ||
31 | + | ||
32 | /* | ||
33 | ** Round up a number to the next larger multiple of 8. This is used | ||
34 | ** to force 8-byte alignment on 64-bit architectures. | ||
35 | @@ -19046,7 +19054,7 @@ struct AggInfo { | ||
36 | ** from source tables rather than from accumulators */ | ||
37 | u8 useSortingIdx; /* In direct mode, reference the sorting index rather | ||
38 | ** than the source table */ | ||
39 | - u16 nSortingColumn; /* Number of columns in the sorting index */ | ||
40 | + u32 nSortingColumn; /* Number of columns in the sorting index */ | ||
41 | int sortingIdx; /* Cursor number of the sorting index */ | ||
42 | int sortingIdxPTab; /* Cursor number of pseudo-table */ | ||
43 | int iFirstReg; /* First register in range for aCol[] and aFunc[] */ | ||
44 | @@ -19055,8 +19063,8 @@ struct AggInfo { | ||
45 | Table *pTab; /* Source table */ | ||
46 | Expr *pCExpr; /* The original expression */ | ||
47 | int iTable; /* Cursor number of the source table */ | ||
48 | - i16 iColumn; /* Column number within the source table */ | ||
49 | - i16 iSorterColumn; /* Column number in the sorting index */ | ||
50 | + int iColumn; /* Column number within the source table */ | ||
51 | + int iSorterColumn; /* Column number in the sorting index */ | ||
52 | } *aCol; | ||
53 | int nColumn; /* Number of used entries in aCol[] */ | ||
54 | int nAccumulator; /* Number of columns that show through to the output. | ||
55 | @@ -116445,7 +116453,9 @@ static void findOrCreateAggInfoColumn( | ||
56 | ){ | ||
57 | struct AggInfo_col *pCol; | ||
58 | int k; | ||
59 | + int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN]; | ||
60 | |||
61 | + assert( mxTerm <= SMXV(i16) ); | ||
62 | assert( pAggInfo->iFirstReg==0 ); | ||
63 | pCol = pAggInfo->aCol; | ||
64 | for(k=0; k<pAggInfo->nColumn; k++, pCol++){ | ||
65 | @@ -116463,6 +116473,10 @@ static void findOrCreateAggInfoColumn( | ||
66 | assert( pParse->db->mallocFailed ); | ||
67 | return; | ||
68 | } | ||
69 | + if( k>mxTerm ){ | ||
70 | + sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm); | ||
71 | + k = mxTerm; | ||
72 | + } | ||
73 | pCol = &pAggInfo->aCol[k]; | ||
74 | assert( ExprUseYTab(pExpr) ); | ||
75 | pCol->pTab = pExpr->y.pTab; | ||
76 | @@ -116496,6 +116510,7 @@ fix_up_expr: | ||
77 | if( pExpr->op==TK_COLUMN ){ | ||
78 | pExpr->op = TK_AGG_COLUMN; | ||
79 | } | ||
80 | + assert( k <= SMXV(pExpr->iAgg) ); | ||
81 | pExpr->iAgg = (i16)k; | ||
82 | } | ||
83 | |||
84 | @@ -116580,13 +116595,19 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ | ||
85 | ** function that is already in the pAggInfo structure | ||
86 | */ | ||
87 | struct AggInfo_func *pItem = pAggInfo->aFunc; | ||
88 | + int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN]; | ||
89 | + assert( mxTerm <= SMXV(i16) ); | ||
90 | for(i=0; i<pAggInfo->nFunc; i++, pItem++){ | ||
91 | if( NEVER(pItem->pFExpr==pExpr) ) break; | ||
92 | if( sqlite3ExprCompare(0, pItem->pFExpr, pExpr, -1)==0 ){ | ||
93 | break; | ||
94 | } | ||
95 | } | ||
96 | - if( i>=pAggInfo->nFunc ){ | ||
97 | + if( i>mxTerm ){ | ||
98 | + sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm); | ||
99 | + i = mxTerm; | ||
100 | + assert( i<pAggInfo->nFunc ); | ||
101 | + }else if( i>=pAggInfo->nFunc ){ | ||
102 | /* pExpr is original. Make a new entry in pAggInfo->aFunc[] | ||
103 | */ | ||
104 | u8 enc = ENC(pParse->db); | ||
105 | @@ -116640,6 +116661,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ | ||
106 | */ | ||
107 | assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); | ||
108 | ExprSetVVAProperty(pExpr, EP_NoReduce); | ||
109 | + assert( i <= SMXV(pExpr->iAgg) ); | ||
110 | pExpr->iAgg = (i16)i; | ||
111 | pExpr->pAggInfo = pAggInfo; | ||
112 | 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 11f103dddc..6c9f1ed5d9 100644 --- a/meta/recipes-support/sqlite/sqlite3_3.48.0.bb +++ b/meta/recipes-support/sqlite/sqlite3_3.48.0.bb | |||
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://sqlite3.h;endline=11;md5=786d3dc581eff03f4fd9e4a77ed0 | |||
6 | SRC_URI = "http://www.sqlite.org/2025/sqlite-autoconf-${SQLITE_PV}.tar.gz \ | 6 | SRC_URI = "http://www.sqlite.org/2025/sqlite-autoconf-${SQLITE_PV}.tar.gz \ |
7 | file://CVE-2025-3277.patch \ | 7 | file://CVE-2025-3277.patch \ |
8 | file://CVE-2025-29088.patch \ | 8 | file://CVE-2025-29088.patch \ |
9 | file://CVE-2025-6965.patch \ | ||
9 | " | 10 | " |
10 | SRC_URI[sha256sum] = "ac992f7fca3989de7ed1fe99c16363f848794c8c32a158dafd4eb927a2e02fd5" | 11 | SRC_URI[sha256sum] = "ac992f7fca3989de7ed1fe99c16363f848794c8c32a158dafd4eb927a2e02fd5" |
11 | 12 | ||