public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/sqlite] f44: Fixes CVE-2026-119371, CVE-2026-119372, CVE-2026-119373, CVE-2026-119374, CVE-2026-119375, CVE-2026-119376, CVE-2026-119377, CVE-2026-119378, CVE-2026-119379, CVE-2026-119586, CVE-2026-119591
@ 2026-11-20 10:13 Petr Khartskhaev
0 siblings, 0 replies; only message in thread
From: Petr Khartskhaev @ 2026-11-20 10:13 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/sqlite
Branch : f44
Commit : b64f908421caa0d8ce3a11ae0b67cff733b0f6a2
Author : Petr Khartskhaev <pkhartsk@redhat.com>
Date : 2026-11-19T18:00:35+01:00
Stats : +1399/-1 in 12 file(s)
URL : https://src.fedoraproject.org/rpms/sqlite/c/b64f908421caa0d8ce3a11ae0b67cff733b0f6a2?branch=f44
Log:
Fixes CVE-2026-119371, CVE-2026-119372, CVE-2026-119373, CVE-2026-119374, CVE-2026-119375, CVE-2026-119376, CVE-2026-119377, CVE-2026-119378, CVE-2026-119379, CVE-2026-119586, CVE-2026-119591
Everything but the latter is taken from upstream fixes.
CVE-2026-119586 is special since it's got upstream fixes but for code
that hasn't yet been introduced in 3.51.2, those being:
https://sqlite.org/src/info/d684ccc9ec4e41d8 and https://sqlite.org/src/info/d684ccc9ec4e41d8
SQLite 3.51.2 is vulnerable to the same exact attack vector, though.
The patch contains fixes that stop it:
1. `src/prepare.c` -- backport of upstream `e21c5bc59a`: schema rows
with surplus text after the first statement are flagged `malformed
database schema` at load time. Blocks `.schema`/`.fullschema`/normal
opens of hostile dbs. `writable_schema` still rescues (via the
existing `SQLITE_NoSchemaError` flag), which is what keeps
`.recover`/`.dump` functional.
2. `src/shell.c.in` -- backport of the `d684ccc9ec` approach, adapted
to 3.34.1's code layout: a new `shellFirstStmt()` runs each recovered
schema statement into a private in-memory **scratch db**
(accumulating in dependency order, exactly like the modern recover
extension's `dbOut`) and emits only the first prepared statement,
`;`-trimmed. Applied at all four emit sites: `.dump` tables
(`dump_callback`), `.dump` indexes/triggers/views
(`run_table_dump_query`), and both `.recover` fallback sites. Plus
the `sql GLOB 'CREATE *'` guard from `9190f1b9b8`.
As well as tests.
Resolves: rhbz#2565590, rhbz#2567031
Co-authored-by: Z.ai GLM 5.3 (rits/zai-org/glm-5-3) via Goose <goose@aaif.dev>
---
diff --git a/sqlite-3.51.2-CVE-2026-119371.patch b/sqlite-3.51.2-CVE-2026-119371.patch
new file mode 100644
index 0000000..3d33a96
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119371.patch
@@ -0,0 +1,129 @@
+From c98f8311e6fa69b5da73d882f06ea84518ceffaf Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 14:51:16 +0100
+Subject: [PATCH 02/11] CVE-2026-119371
+
+---
+ src/select.c | 22 ++++++++++++++++++++++
+ src/sqliteInt.h | 1 +
+ test/with2.test | 33 +++++++++++++++++++++++++++++++++
+ 3 files changed, 56 insertions(+)
+
+diff --git a/src/select.c b/src/select.c
+index 8e4c939..4e19ea2 100644
+--- a/src/select.c
++++ b/src/select.c
+@@ -2441,6 +2441,20 @@ void sqlite3SubqueryColumnTypes(
+ pTab->szTabRow = 1; /* Any non-zero value works */
+ }
+
++/*
++** Check the current subquery nesting depth. Return true and set an
++** error if it has gone too deep.
++*/
++static int checkSubqueryNestingDepth(Parse *pParse){
++#if SQLITE_MAX_EXPR_DEPTH>0
++ if( pParse->nNestSel >= pParse->db->aLimit[SQLITE_LIMIT_EXPR_DEPTH] ){
++ sqlite3ErrorMsg(pParse, "VIEWs and/or subqueries nested too deep");
++ return 1;
++ }
++#endif
++ return 0;
++}
++
+ /*
+ ** Given a SELECT statement, generate a Table structure that describes
+ ** the result set of that SELECT.
+@@ -2450,6 +2464,8 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect, char aff){
+ sqlite3 *db = pParse->db;
+ u64 savedFlags;
+
++ pParse->nNestSel++;
++ if( checkSubqueryNestingDepth(pParse) ) return 0;
+ savedFlags = db->flags;
+ db->flags &= ~(u64)SQLITE_FullColNames;
+ db->flags |= SQLITE_ShortColNames;
+@@ -2471,6 +2487,8 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect, char aff){
+ sqlite3DeleteTable(db, pTab);
+ return 0;
+ }
++ pParse->nNestSel--;
++ assert( pParse->nNestSel>=0 );
+ return pTab;
+ }
+
+@@ -5882,6 +5900,8 @@ static int resolveFromTermToCte(
+ pRecTerm = pRecTerm->pPrior;
+ }
+
++ pParse->nNestSel++;
++ if( checkSubqueryNestingDepth(pParse) ) return 2;
+ pCte->zCteErr = "circular reference: %s";
+ pSavedWith = pParse->pWith;
+ pParse->pWith = pWith;
+@@ -5906,6 +5926,8 @@ static int resolveFromTermToCte(
+ }
+ }
+ pParse->pWith = pWith;
++ pParse->nNestSel--;
++ assert( pParse->nNestSel>=0 );
+
+ for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);
+ pEList = pLeft->pEList;
+diff --git a/src/sqliteInt.h b/src/sqliteInt.h
+index 5cc134a..c55f7a5 100644
+--- a/src/sqliteInt.h
++++ b/src/sqliteInt.h
+@@ -3909,6 +3909,7 @@ struct Parse {
+ int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
+ int iSelfTab; /* Table associated with an index on expr, or negative
+ ** of the base register during check-constraint eval */
++ int nNestSel; /* Number of nested SELECT statements and/or VIEWs */
+ int nLabel; /* The *negative* of the number of labels used */
+ int nLabelAlloc; /* Number of slots in aLabel */
+ int *aLabel; /* Space to hold the labels */
+diff --git a/test/with2.test b/test/with2.test
+index 68790fe..a6125bd 100644
+--- a/test/with2.test
++++ b/test/with2.test
+@@ -635,4 +635,37 @@ do_execsql_test 13.1 {
+ SELECT * FROM t1, t3;
+ } {111 222}
+
++# Bug 2026-10-04T04:58:58Z
++reset_db
++sqlite3_limit db SQLITE_LIMIT_EXPR_DEPTH 12
++do_catchsql_test 14.1 {
++ WITH c0 AS (SELECT 1 AS x),
++ c1 AS (SELECT x FROM c0),
++ c2 AS (SELECT x FROM c1),
++ c3 AS (SELECT x FROM c2),
++ c4 AS (SELECT x FROM c3),
++ c5 AS (SELECT x FROM c4),
++ c6 AS (SELECT x FROM c5),
++ c7 AS (SELECT x FROM c6),
++ c8 AS (SELECT x FROM c7),
++ c9 AS (SELECT x FROM c8),
++ c10 AS (SELECT x FROM c9)
++ SELECT x FROM c10;
++} {0 1}
++sqlite3_limit db SQLITE_LIMIT_EXPR_DEPTH 11
++do_catchsql_test 14.2 {
++ WITH c00 AS (SELECT 1 AS x),
++ c1 AS (SELECT x FROM c00),
++ c2 AS (SELECT x FROM c1),
++ c3 AS (SELECT x FROM c2),
++ c4 AS (SELECT x FROM c3),
++ c5 AS (SELECT x FROM c4),
++ c6 AS (SELECT x FROM c5),
++ c7 AS (SELECT x FROM c6),
++ c8 AS (SELECT x FROM c7),
++ c9 AS (SELECT x FROM c8),
++ c10 AS (SELECT x FROM c9)
++ SELECT x FROM c10;
++} {1 {VIEWs and/or subqueries nested too deep}}
++
+ finish_test
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119372.patch b/sqlite-3.51.2-CVE-2026-119372.patch
new file mode 100644
index 0000000..b05266b
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119372.patch
@@ -0,0 +1,64 @@
+From d9f3a8b9e270b656f6d078da2450a55f5eecce63 Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 14:52:28 +0100
+Subject: [PATCH 03/11] CVE-2026-119372
+
+---
+ ext/fts3/fts3_snippet.c | 11 ++++++++---
+ test/fts3snippet2.test | 12 ++++++++++++
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/ext/fts3/fts3_snippet.c b/ext/fts3/fts3_snippet.c
+index 9c7f0ad..ff04ac0 100644
+--- a/ext/fts3/fts3_snippet.c
++++ b/ext/fts3/fts3_snippet.c
+@@ -533,6 +533,7 @@ static int fts3BestSnippet(
+ sqlite3_int64 nByte; /* Number of bytes of space to allocate */
+ int iBestScore = -1; /* Best snippet score found so far */
+ int i; /* Loop counter */
++ Fts3Expr *pExpr = pCsr->pExpr;
+
+ memset(&sIter, 0, sizeof(sIter));
+
+@@ -561,9 +562,13 @@ static int fts3BestSnippet(
+ sIter.nSnippet = nSnippet;
+ sIter.nPhrase = nList;
+ sIter.iCurrent = -1;
+- rc = sqlite3Fts3ExprIterate(
+- pCsr->pExpr, fts3SnippetFindPositions, (void*)&sIter
+- );
++ rc = sqlite3Fts3ExprIterate(pExpr, fts3SnippetFindPositions, (void*)&sIter);
++ if( rc==SQLITE_OK ){
++ /* Iterate through the expression twice, in case pointers garnered during
++ ** the first iteration are invalidated by a call to fts5EvalRestart(). */
++ rc = sqlite3Fts3ExprIterate(pExpr, fts3SnippetFindPositions, (void*)&sIter);
++
++ }
+ if( rc==SQLITE_OK ){
+
+ /* Set the *pmSeen output variable. */
+diff --git a/test/fts3snippet2.test b/test/fts3snippet2.test
+index f55a5f2..ea5c6ac 100644
+--- a/test/fts3snippet2.test
++++ b/test/fts3snippet2.test
+@@ -66,5 +66,17 @@ do_execsql_test 3.1 {
+ SELECT length(snippet(f)) FROM f WHERE b MATCH x'0565056505650565056505650565056505650565058405800565056505650565056505651e650565056505650565056505650d056505056565056505650565056505840580056505650565056505650565056505650565056505650565050565056505640565056505650565056505651e05650565056522650565056505650d051e056505650565286505650565056505056505650565056505650565056505650565056505650565056505656505650565056505650d05650505656505650565ef65056505844c746e65650565056505650565056505650565056505650565058405800565056505650565056505651e650565056505650565056505650d056505056565056505650565056505840580056505650565056f05650565056505650565056505650565050565056505640565056505650565056505651e05650565056505650565056505650505656565056505650565056505651e0565056505650565056505650565052265056505650569056505650565056505650565056505650565056505650500406505650565056505650565056505000101e5c501014b010101c501c5c501010101f50102010101010141010141010001017bf15905000000000017';
+ } {192}
+
++#-------------------------------------------------------------------------
++reset_db
++
++do_execsql_test 4.0 {
++ CREATE VIRTUAL TABLE ft0 USING fts4;
++ INSERT INTO ft0 VALUES('0*bbb a');
++}
++
++do_execsql_test 4.1 {
++ SELECT snippet(ft0,'') FROM ft0 WHERE ft0 MATCH '"a" OR "" bbb NEAR 0 NEAR 1';
++} {{0</b>*bbb</b> a</b>}}
++
+ set sqlite_fts3_enable_parentheses 0
+ finish_test
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119373.patch b/sqlite-3.51.2-CVE-2026-119373.patch
new file mode 100644
index 0000000..3ced652
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119373.patch
@@ -0,0 +1,69 @@
+From 74e74e9e32b74dbb2fcbc137103485e705e0b51f Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 14:53:46 +0100
+Subject: [PATCH 04/11] CVE-2026-119373
+
+---
+ ext/fts5/fts5_index.c | 6 +++---
+ ext/fts5/test/fts5prefix2.test | 17 +++++++++++++++++
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c
+index 63840de..4f22aa9 100644
+--- a/ext/fts5/fts5_index.c
++++ b/ext/fts5/fts5_index.c
+@@ -6038,7 +6038,7 @@ static void fts5MergeRowidLists(
+ (void)nBuf;
+ memset(&out, 0, sizeof(out));
+ assert( nBuf==1 );
+- sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n);
++ sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9);
+ if( p->rc ) return;
+
+ fts5NextRowid(p1, &i1, &iRowid1);
+@@ -6046,12 +6046,12 @@ static void fts5MergeRowidLists(
+ while( i1>=0 || i2>=0 ){
+ if( i1>=0 && (i2<0 || iRowid1<iRowid2) ){
+ assert( iOut==0 || iRowid1>iOut );
+- fts5BufferSafeAppendVarint(&out, iRowid1 - iOut);
++ fts5BufferSafeAppendVarint(&out, (u64)iRowid1 - (u64)iOut);
+ iOut = iRowid1;
+ fts5NextRowid(p1, &i1, &iRowid1);
+ }else{
+ assert( iOut==0 || iRowid2>iOut );
+- fts5BufferSafeAppendVarint(&out, iRowid2 - iOut);
++ fts5BufferSafeAppendVarint(&out, (u64)iRowid2 - (u64)iOut);
+ iOut = iRowid2;
+ if( i1>=0 && iRowid1==iRowid2 ){
+ fts5NextRowid(p1, &i1, &iRowid1);
+diff --git a/ext/fts5/test/fts5prefix2.test b/ext/fts5/test/fts5prefix2.test
+index 0860b3c..e9b6545 100644
+--- a/ext/fts5/test/fts5prefix2.test
++++ b/ext/fts5/test/fts5prefix2.test
+@@ -80,6 +80,23 @@ foreach {tn newrowid} {
+ } $newrowid
+ }
+
++#-------------------------------------------------------------------------
++foreach_detail_mode $::testprefix-4 {
++ reset_db
++ do_execsql_test 1 {
++ CREATE VIRTUAL TABLE t1 USING fts5(x, detail=%DETAIL%);
++ WITH RECURSIVE c(x) AS (
++ VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<55
++ )
++ INSERT INTO t1(rowid, x) SELECT x,'ab' FROM c;
++ INSERT INTO t1(rowid, x) VALUES(-9223372036854775808,'abc');
++ }
++
++ do_execsql_test 2 {
++ SELECT count(*) FROM t1('a*')
++ } {56}
++}
++
+ finish_test
+
+
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119374.patch b/sqlite-3.51.2-CVE-2026-119374.patch
new file mode 100644
index 0000000..9ad9902
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119374.patch
@@ -0,0 +1,272 @@
+From a3a3f17811e147efd9e093024f32ed38746099eb Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 14:54:54 +0100
+Subject: [PATCH 05/11] CVE-2026-119374
+
+---
+ ext/fts5/fts5_index.c | 18 +--
+ ext/fts5/test/fts5corrupt.test | 202 +++++++++++++++++++++++++++++++++
+ 2 files changed, 213 insertions(+), 7 deletions(-)
+
+diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c
+index 4f22aa9..5194b49 100644
+--- a/ext/fts5/fts5_index.c
++++ b/ext/fts5/fts5_index.c
+@@ -5450,32 +5450,36 @@ static void fts5DoSecureDelete(
+ if( p->rc==SQLITE_OK ){
+ const int nMove = nPg - iNextOff; /* Number of bytes to move */
+ int nShift = iNextOff - iOff; /* Distance to move them */
+-
++ int nNewPg = 0;
+ int iPrevKeyOut = 0;
+- int iKeyIn = 0;
++ i64 iKeyIn = 0;
+
+ memmove(&aPg[iOff], &aPg[iNextOff], nMove);
+ iPgIdx -= nShift;
+- nPg = iPgIdx;
++ nNewPg = iPgIdx;
+ fts5PutU16(&aPg[2], iPgIdx);
+
+ for(iIdx=0; iIdx<nIdx; /* no-op */){
+ u32 iVal = 0;
+ iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
+ iKeyIn += iVal;
++ if( iKeyIn>nPg ){
++ p->rc = FTS5_CORRUPT;
++ break;
++ }
+ if( iKeyIn!=iDelKeyOff ){
+ int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0));
+- nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut);
++ nNewPg += sqlite3Fts5PutVarint(&aPg[nNewPg], iKeyOut - iPrevKeyOut);
+ iPrevKeyOut = iKeyOut;
+ }
+ }
+
+- if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
++ if( p->rc==SQLITE_OK && iPgIdx==nNewPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
+ fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
+ }
+
+- assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
+- fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nPg);
++ assert_nc( nNewPg>4 || fts5GetU16(aPg)==0 );
++ fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nNewPg);
+ }
+ sqlite3_free(aIdx);
+ }
+diff --git a/ext/fts5/test/fts5corrupt.test b/ext/fts5/test/fts5corrupt.test
+index 0abd8b8..79d01fa 100644
+--- a/ext/fts5/test/fts5corrupt.test
++++ b/ext/fts5/test/fts5corrupt.test
+@@ -122,4 +122,206 @@ do_catchsql_test 4.3 {
+ DELETE FROM t2 WHERE rowid=3
+ } {1 {database disk image is malformed}}
+
++do_test 4.0 {
++ sqlite3 db {}
++ db deserialize [decode_hexdb {
++.open --hexdb
++| size 5120 pagesize 512 filename poc.db
++| page 1 offset 0
++| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
++| 16: 02 00 01 01 00 40 20 20 00 00 00 04 00 00 00 0a .....@ ........
++| 32: 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 04 ................
++| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................
++| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 ................
++| 96: 00 2e 99 b0 05 00 00 00 01 01 fb 00 00 00 00 08 ................
++| 112: 01 fb 00 a0 00 98 00 00 00 00 00 00 00 00 00 00 ................
++| 144: 00 00 00 00 00 00 00 00 06 05 06 00 00 00 00 00 ................
++| 160: 52 04 06 17 1f 1f 01 75 74 61 62 6c 65 74 5f 63 R......utablet_c
++| 176: 6f 6e 74 65 6e 74 74 5f 63 6f 6e 74 65 6e 74 04 ontentt_content.
++| 192: 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 5f CREATE TABLE 't_
++| 208: 63 6f 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 content'(id INTE
++| 224: 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c GER PRIMARY KEY,
++| 240: 20 63 30 29 66 03 07 17 17 17 01 81 2b 74 61 62 c0)f.......+tab
++| 256: 6c 65 74 5f 69 64 78 74 5f 69 64 78 03 43 52 45 let_idxt_idx.CRE
++| 272: 41 54 45 20 54 41 42 4c 45 20 27 74 5f 69 64 78 ATE TABLE 't_idx
++| 288: 27 28 73 65 67 69 64 2c 20 74 65 72 6d 2c 20 70 '(segid, term, p
++| 304: 67 6e 6f 2c 20 50 52 49 4d 41 52 59 20 4b 45 59 gno, PRIMARY KEY
++| 320: 28 73 65 67 69 64 2c 20 74 65 72 6d 29 29 20 57 (segid, term)) W
++| 336: 49 54 48 4f 55 54 20 52 4f 57 49 44 51 02 06 17 ITHOUT ROWIDQ...
++| 352: 19 19 01 7f 74 61 62 6c 65 74 5f 64 61 74 61 74 ....tablet_datat
++| 368: 5f 64 61 74 61 02 43 52 45 41 54 45 20 54 41 42 _data.CREATE TAB
++| 384: 4c 45 20 27 74 5f 64 61 74 61 27 28 69 64 20 49 LE 't_data'(id I
++| 400: 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b NTEGER PRIMARY K
++| 416: 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 29 4f EY, block BLOB)O
++| 432: 01 07 17 0f 0f 08 81 0f 74 61 62 6c 65 74 74 43 ........tablettC
++| 448: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
++| 464: 42 4c 45 20 74 20 55 53 49 4e 47 20 66 74 73 35 BLE t USING fts5
++| 480: 28 61 2c 64 65 74 61 69 6c 3d 63 6f 6c 75 6d 6e (a,detail=column
++| 496: 2c 70 72 65 66 69 78 3d 27 32 20 00 00 00 06 03 ,prefix='2 .....
++| page 2 offset 512
++| 0: 0d 00 00 00 03 00 9e 00 01 e8 01 ef 00 9e 00 00 ................
++| 144: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8a 36 ...............6
++| 160: 84 80 80 80 80 01 04 00 94 70 00 00 01 12 06 30 .........p.....0
++| 176: 61 6c 70 68 61 01 02 02 01 04 62 65 74 61 01 02 alpha.....beta..
++| 192: 02 01 05 64 65 6c 74 61 01 02 02 01 04 65 63 68 ...delta.....ech
++| 208: 6f 01 02 02 01 07 66 6f 78 74 72 6f 74 01 02 02 o.....foxtrot...
++| 224: 01 05 67 61 6d 6d 61 01 02 02 02 03 6f 6c 66 01 ..gamma.....olf.
++| 240: 02 02 01 05 68 6f 74 65 6c 01 02 02 00 03 31 61 ....hotel.....1a
++| 256: 6c 01 02 02 01 02 62 65 01 02 02 01 02 64 65 01 l.....be.....de.
++| 272: 02 02 01 02 65 63 01 02 02 01 02 66 6f 01 02 02 ....ec.....fo...
++| 288: 01 02 67 61 01 02 02 02 01 6f 01 02 02 01 02 68 ..ga.....o.....h
++| 304: 6f 01 02 02 00 04 32 61 6c 70 01 02 02 01 03 62 o.....2alp.....b
++| 320: 65 74 01 02 02 01 03 64 65 6c 01 02 02 01 03 65 et.....del.....e
++| 336: 63 68 01 02 02 01 03 66 6f 78 01 02 02 01 03 67 ch.....fox.....g
++| 352: 61 6d 01 02 02 02 02 6f 6c 01 02 02 01 03 68 6f am.....ol.....ho
++| 368: 74 01 02 02 00 05 33 61 6c 70 68 01 02 02 01 04 t.....3alph.....
++| 384: 62 65 74 61 01 02 02 01 04 64 65 6c 74 01 02 02 beta.....delt...
++| 400: 01 04 65 63 68 6f 01 02 02 01 04 66 6f 78 74 01 ..echo.....foxt.
++| 416: 02 02 01 04 67 61 6d 6d 01 02 02 02 03 6f 6c 66 ....gamm.....olf
++| 432: 01 02 02 01 04 68 6f 74 65 01 02 02 04 0a 09 0a .....hote.......
++| 448: 09 0c 0a 08 0a 08 07 07 07 07 07 06 07 09 08 08 ................
++| 464: 08 08 08 07 08 0a 09 09 09 09 09 08 ff ff ff ff ................
++| 480: ff ff ff ff 00 00 00 09 05 01 03 00 10 01 08 0f ................
++| 496: 0a 03 00 24 00 00 00 01 01 01 01 00 01 01 01 01 ...$............
++| page 3 offset 1024
++| 0: 0a 00 00 00 01 01 fa 00 01 fa 00 00 00 00 00 00 ................
++| 496: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02 ................
++| page 4 offset 1536
++| 0: 0d 00 00 00 01 01 cd 00 01 cd 00 00 00 00 00 00 ................
++| 448: 00 00 00 00 00 00 00 00 00 00 00 00 00 31 01 03 .............1..
++| 464: 00 69 61 6c 70 68 61 20 62 65 74 61 20 67 61 6d .ialpha beta gam
++| 480: 6d 61 20 64 65 6c 74 61 20 65 63 68 6f 20 66 6f ma delta echo fo
++| 496: 78 74 72 6f 74 20 67 6f 6c 66 20 68 6f 74 65 6c xtrot golf hotel
++| page 5 offset 2048
++| 0: 0d 00 00 00 01 01 fa 00 01 fa 00 00 00 00 00 00 ................
++| 496: 00 00 00 00 00 00 00 00 00 00 04 01 03 00 0e 08 ................
++| page 6 offset 2560
++| 0: 0d 00 00 00 03 00 f4 00 01 af 01 5c 00 f4 00 a0 ................
++| 16: 00 47 00 3f 00 00 00 00 00 00 00 00 00 00 00 00 .G.?............
++| 48: 00 00 00 00 06 05 06 00 00 00 00 00 52 04 06 06 ............R...
++| 64: 06 06 00 00 00 00 00 57 05 06 17 1f 1f 01 7f 74 .......W.......t
++| 80: 61 62 6c 65 74 5f 64 6f 63 73 69 7a 65 74 5f 64 ablet_docsizet_d
++| 96: 6f 63 73 69 7a 65 05 43 52 45 41 54 45 20 54 41 ocsize.CREATE TA
++| 112: 42 4c 45 20 27 74 5f 64 6f 63 73 69 7a 65 27 28 BLE 't_docsize'(
++| 128: 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 id INTEGER PRIMA
++| 144: 52 59 20 4b 45 59 2c 20 73 7a 20 42 4c 4f 42 29 RY KEY, sz BLOB)
++| 160: 52 04 06 17 1f 1f 01 75 74 61 62 6c 65 74 5f 63 R......utablet_c
++| 176: 6f 6e 74 65 6e 74 74 5f 63 6f 6e 74 65 6e 74 04 ontentt_content.
++| 192: 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 5f CREATE TABLE 't_
++| 208: 63 6f 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 content'(id INTE
++| 224: 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c GER PRIMARY KEY,
++| 240: 20 63 30 29 66 03 07 17 17 17 01 81 2b 74 61 62 c0)f.......+tab
++| 256: 6c 65 74 5f 69 64 78 74 5f 69 64 78 03 43 52 45 let_idxt_idx.CRE
++| 272: 41 54 45 20 54 41 42 4c 45 20 27 74 5f 69 64 78 ATE TABLE 't_idx
++| 288: 27 28 73 65 67 69 64 2c 20 74 65 72 6d 2c 20 70 '(segid, term, p
++| 304: 67 6e 6f 2c 20 50 52 49 4d 41 52 59 20 4b 45 59 gno, PRIMARY KEY
++| 320: 28 73 65 67 69 64 2c 20 74 65 72 6d 29 29 20 57 (segid, term)) W
++| 336: 49 54 48 4f 55 54 20 52 4f 57 49 44 51 02 06 17 ITHOUT ROWIDQ...
++| 352: 19 19 01 7f 74 61 62 6c 65 74 5f 64 61 74 61 74 ....tablet_datat
++| 368: 5f 64 61 74 61 02 43 52 45 41 54 45 20 54 41 42 _data.CREATE TAB
++| 384: 4c 45 20 27 74 5f 64 61 74 61 27 28 69 64 20 49 LE 't_data'(id I
++| 400: 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b NTEGER PRIMARY K
++| 416: 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 29 4f EY, block BLOB)O
++| 432: 01 07 17 0f 0f 08 81 0f 74 61 62 6c 65 74 74 43 ........tablettC
++| 448: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
++| 464: 42 4c 45 20 74 20 55 53 49 4e 47 20 66 74 73 35 BLE t USING fts5
++| 480: 28 61 2c 64 65 74 61 69 6c 3d 63 6f 6c 75 6d 6e (a,detail=column
++| 496: 2c 70 72 65 66 69 78 3d 27 32 20 33 20 34 27 29 ,prefix='2 3 4')
++| page 7 offset 3072
++| 0: 0a 00 00 00 02 01 e3 00 01 e3 01 f4 00 00 00 00 ................
++| 480: 00 00 00 10 03 27 09 73 65 63 75 72 65 2d 64 65 .....'.secure-de
++| 496: 6c 65 74 65 0b 03 1b 01 76 65 72 73 69 6f 6e 04 lete....version.
++| page 8 offset 3584
++| 0: 0d 00 00 00 03 00 fe 00 01 ac 01 53 00 fe 00 00 ...........S....
++| 240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 06 ..............S.
++| 256: 06 17 1d 1d 01 7b 74 61 62 6c 65 74 5f 63 6f 6e ......tablet_con
++| 272: 66 69 67 74 5f 63 6f 6e 66 69 67 07 43 52 45 41 figt_config.CREA
++| 288: 54 45 20 54 41 42 4c 45 20 27 74 5f 63 6f 6e 66 TE TABLE 't_conf
++| 304: 69 67 27 28 6b 20 50 52 49 4d 41 52 59 20 4b 45 ig'(k PRIMARY KE
++| 320: 59 2c 20 76 29 20 57 49 54 48 4f 55 54 20 52 4f Y, v) WITHOUT RO
++| 336: 57 49 44 57 05 06 17 1f 1f 01 7f 74 61 62 6c 65 WIDW.......table
++| 352: 74 5f 64 6f 63 73 69 7a 65 74 5f 64 6f 63 73 69 t_docsizet_docsi
++| 368: 7a 65 05 43 52 45 41 54 45 20 54 41 42 4c 45 20 ze.CREATE TABLE
++| 384: 27 74 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 49 't_docsize'(id I
++| 400: 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b NTEGER PRIMARY K
++| 416: 45 59 2c 20 73 7a 20 42 4c 4f 42 29 52 04 06 17 EY, sz BLOB)R...
++| 432: 1f 1f 01 75 74 61 62 6c 65 74 5f 63 6f 6e 74 65 ...utablet_conte
++| 448: 6e 74 74 5f 63 6f 6e 74 65 6e 74 04 43 52 45 41 ntt_content.CREA
++| 464: 54 45 20 54 41 42 4c 45 20 27 74 5f 63 6f 6e 74 TE TABLE 't_cont
++| 480: 65 6e 74 27 28 69 64 20 49 4e 54 45 47 45 52 20 ent'(id INTEGER
++| 496: 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 63 30 29 PRIMARY KEY, c0)
++| page 9 offset 4096
++| 0: 00 00 00 0a 00 ff ff ff ff ff ff ff ff 00 ff ff ................
++| 16: ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ................
++| 32: ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ................
++| 48: ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ................
++| 64: ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ................
++| 80: ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ................
++| 96: ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff ................
++| 112: 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ................
++| 128: ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ................
++| 144: ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ................
++| 160: ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ................
++| 176: ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ................
++| 192: ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ................
++| 208: ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ................
++| 224: ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ................
++| 240: ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff ................
++| 256: 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ................
++| 272: ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ................
++| 288: ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ................
++| 304: ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ................
++| 320: ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ................
++| 336: ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ................
++| 352: ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ................
++| 368: ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ................
++| 384: ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff ................
++| 400: 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ................
++| 416: ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ................
++| 432: ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ................
++| 448: ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ................
++| 464: ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ................
++| 480: ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ................
++| 496: ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ................
++| page 10 offset 4608
++| 0: 00 00 00 00 ff ff ff ff ff 00 ff ff ff ff ff ff ................
++| 16: ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ................
++| 32: ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ................
++| 48: ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ................
++| 64: ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ................
++| 80: ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ................
++| 96: ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ................
++| 112: ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ................
++| 128: ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff ................
++| 144: 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ................
++| 160: ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ................
++| 176: ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ................
++| 192: ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ................
++| 208: ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ................
++| 224: ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ................
++| 240: ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ................
++| 256: ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ................
++| 272: ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff ................
++| 288: 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ................
++| 304: ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ................
++| 320: ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ................
++| 336: ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ................
++| 352: ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ................
++| 368: ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ................
++| 384: ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ................
++| 400: ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ................
++| 416: ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff ................
++| 432: 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ................
++| 448: ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ff ff ................
++| 464: ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ff ff ................
++| 480: ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 ................
++| 496: ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ................
++| end poc.db
++ }]
++} {}
++
++do_catchsql_test 4.1 {
++ DELETE FROM t WHERE rowid = 1;
++} {1 {fts5: corruption in table "t"}}
++
+ finish_test
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119375.patch b/sqlite-3.51.2-CVE-2026-119375.patch
new file mode 100644
index 0000000..481818b
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119375.patch
@@ -0,0 +1,33 @@
+From 163ac727a573516a28c29ab2d7a8d3d9a0fa3647 Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 14:58:00 +0100
+Subject: [PATCH 06/11] CVE-2026-119375
+
+---
+ src/wal.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/wal.c b/src/wal.c
+index 41018b5..de9198a 100644
+--- a/src/wal.c
++++ b/src/wal.c
+@@ -3642,11 +3642,15 @@ int sqlite3WalReadFrame(
+ i64 iOffset;
+ sz = pWal->hdr.szPage;
+ sz = (sz&0xfe00) + ((sz&0x0001)<<16);
++ if( nOut>sz ){
++ memset(pOut+sz, 0, nOut-sz);
++ nOut = sz;
++ }
+ testcase( sz<=32768 );
+ testcase( sz>=65536 );
+ iOffset = walFrameOffset(iRead, sz) + WAL_FRAME_HDRSIZE;
+ /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */
+- return sqlite3OsRead(pWal->pWalFd, pOut, (nOut>sz ? sz : nOut), iOffset);
++ return sqlite3OsRead(pWal->pWalFd, pOut, nOut, iOffset);
+ }
+
+ /*
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119376.patch b/sqlite-3.51.2-CVE-2026-119376.patch
new file mode 100644
index 0000000..45ba9ab
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119376.patch
@@ -0,0 +1,84 @@
+From 9ae1c273a303ea9357f0071930d0de871161bd1e Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 15:23:31 +0100
+Subject: [PATCH 07/11] CVE-2026-119376
+
+---
+ src/expr.c | 12 +++++++++---
+ src/sqliteInt.h | 4 ++--
+ test/sqllimits1.test | 7 +++++++
+ 3 files changed, 18 insertions(+), 5 deletions(-)
+
+diff --git a/src/expr.c b/src/expr.c
+index 349015f..5514467 100644
+--- a/src/expr.c
++++ b/src/expr.c
+@@ -173,23 +173,29 @@ int sqlite3ExprDataType(const Expr *pExpr){
+ ** and the pExpr parameter is returned unchanged.
+ */
+ Expr *sqlite3ExprAddCollateToken(
+- const Parse *pParse, /* Parsing context */
++ Parse *pParse, /* Parsing context */
+ Expr *pExpr, /* Add the "COLLATE" clause to this expression */
+ const Token *pCollName, /* Name of collating sequence */
+ int dequote /* True to dequote pCollName */
+ ){
+- if( pCollName->n>0 ){
++ if( pCollName->n>0 && pParse->nErr==0 ){
+ Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote);
++ assert( pExpr!=0 );
+ if( pNew ){
+ pNew->pLeft = pExpr;
+ pNew->flags |= EP_Collate|EP_Skip;
++#if SQLITE_MAX_EXPR_DEPTH>0
++ pNew->nHeight = pExpr->nHeight+1;
++ sqlite3ExprCheckHeight(pParse, pNew->nHeight);
++ testcase( pParse->nErr>0 );
++#endif
+ pExpr = pNew;
+ }
+ }
+ return pExpr;
+ }
+ Expr *sqlite3ExprAddCollateString(
+- const Parse *pParse, /* Parsing context */
++ Parse *pParse, /* Parsing context */
+ Expr *pExpr, /* Add the "COLLATE" clause to this expression */
+ const char *zC /* The collating sequence name */
+ ){
+diff --git a/src/sqliteInt.h b/src/sqliteInt.h
+index c55f7a5..bb566ff 100644
+--- a/src/sqliteInt.h
++++ b/src/sqliteInt.h
+@@ -5363,8 +5363,8 @@ void sqlite3SetTextEncoding(sqlite3 *db, u8);
+ CollSeq *sqlite3ExprCollSeq(Parse *pParse, const Expr *pExpr);
+ CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, const Expr *pExpr);
+ int sqlite3ExprCollSeqMatch(Parse*,const Expr*,const Expr*);
+-Expr *sqlite3ExprAddCollateToken(const Parse *pParse, Expr*, const Token*, int);
+-Expr *sqlite3ExprAddCollateString(const Parse*,Expr*,const char*);
++Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int);
++Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*);
+ Expr *sqlite3ExprSkipCollate(Expr*);
+ Expr *sqlite3ExprSkipCollateAndLikely(Expr*);
+ int sqlite3CheckCollSeq(Parse *, CollSeq *);
+diff --git a/test/sqllimits1.test b/test/sqllimits1.test
+index efe656d..410f74f 100644
+--- a/test/sqllimits1.test
++++ b/test/sqllimits1.test
+@@ -713,6 +713,13 @@ if {$SQLITE_MAX_EXPR_DEPTH==0} {
+ SELECT $expr
+ }]
+ } "1 {Expression tree is too large (maximum depth $::SQLITE_MAX_EXPR_DEPTH)}"
++ do_test sqllimits1-9.1b {
++ set max $::SQLITE_MAX_EXPR_DEPTH
++ set expr "('abc'='ABC' [string repeat { COLLATE nocase} $max])"
++ catchsql [subst {
++ SELECT $expr
++ }]
++ } "1 {Expression tree is too large (maximum depth $::SQLITE_MAX_EXPR_DEPTH)}"
+
+ if 0 {
+ # Attempting to beat the expression depth limit using nested SELECT
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119377.patch b/sqlite-3.51.2-CVE-2026-119377.patch
new file mode 100644
index 0000000..3fd499e
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119377.patch
@@ -0,0 +1,86 @@
+From d052bdf5fdb3150d01cfd506f2c0b8ed1c56e6f8 Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 15:24:41 +0100
+Subject: [PATCH 08/11] CVE-2026-119377
+
+---
+ src/resolve.c | 19 ++++++++++++++-----
+ test/auth.test | 25 +++++++++++++++++++++++++
+ 2 files changed, 39 insertions(+), 5 deletions(-)
+
+diff --git a/src/resolve.c b/src/resolve.c
+index 3961a20..b3683d9 100644
+--- a/src/resolve.c
++++ b/src/resolve.c
+@@ -751,7 +751,7 @@ static int lookupName(
+ ** cnt>1 means there were two or more matches.
+ **
+ ** cnt==0 is always an error. cnt>1 is often an error, but might
+- ** be multiple matches for a NATURAL LEFT JOIN or a LEFT JOIN USING.
++ ** be multiple matches for a NATURAL OUTER JOIN or a OUTER JOIN USING.
+ */
+ assert( pFJMatch==0 || cnt>0 );
+ assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) );
+@@ -833,10 +833,19 @@ lookupname_end:
+ if( cnt==1 ){
+ assert( pNC!=0 );
+ #ifndef SQLITE_OMIT_AUTHORIZATION
+- if( pParse->db->xAuth
+- && (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER)
+- ){
+- sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
++ if( db->xAuth ){
++ if( pFJMatch ){
++ assert( pExpr->op==TK_FUNCTION );
++ assert( sqlite3_stricmp(pExpr->u.zToken,"coalesce")==0 );
++ assert( pExpr->x.pList==pFJMatch );
++ assert( pFJMatch->nExpr>0 );
++ for(i=0; i<pFJMatch->nExpr; i++){
++ assert( pFJMatch->a[i].pExpr->op==TK_COLUMN );
++ sqlite3AuthRead(pParse,pFJMatch->a[i].pExpr,pSchema,pNC->pSrcList);
++ }
++ }else if( pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER ){
++ sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
++ }
+ }
+ #endif
+ /* Increment the nRef value on all name contexts from TopNC up to
+diff --git a/test/auth.test b/test/auth.test
+index 1d56f70..a3767fe 100644
+--- a/test/auth.test
++++ b/test/auth.test
+@@ -2672,6 +2672,31 @@ do_test auth-8.4 {
+ SQLITE_READ t7 {} {} {} \
+ ]
+
++# Bug 2026-07-05T08:15:45Z
++#
++proc auth {op args} {
++ foreach {a b c d} $args break
++ lappend ::authargs $op $a $b $c $d
++ return "SQLITE_OK"
++}
++do_execsql_test auth-9.1 {
++ DROP TABLE IF EXISTS t1;
++ DROP TABLE IF EXISTS t2;
++ CREATE TABLE t1(x,y1); INSERT INTO t1 VALUES(1,'a');
++ CREATE TABLE t2(x,y2); INSERT INTO t2 VALUES(99,'z');
++}
++set ::authargs [list]
++do_execsql_test auth-9.2 {
++ SELECT x,y2 FROM t1 FULL JOIN t2 USING(x);
++} {1 {} 99 z}
++do_test auth-9.3 {
++ set ::authargs
++} [list \
++ SQLITE_SELECT {} {} {} {} \
++ SQLITE_READ t1 x main {} \
++ SQLITE_READ t2 x main {} \
++ SQLITE_READ t2 y2 main {} \
++]
+
+ rename proc {}
+ rename proc_real proc
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119378.patch b/sqlite-3.51.2-CVE-2026-119378.patch
new file mode 100644
index 0000000..e5aebc0
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119378.patch
@@ -0,0 +1,85 @@
+From 94fed19b9159497974083f6d257359d76d48cd59 Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 15:27:17 +0100
+Subject: [PATCH 09/11] CVE-2026-119378
+
+---
+ ext/rtree/rtree.c | 12 +++++++++++-
+ ext/rtree/rtreeI.test | 31 +++++++++++++++++++++++++++++++
+ 2 files changed, 42 insertions(+), 1 deletion(-)
+
+diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c
+index d8567b6..0528b92 100644
+--- a/ext/rtree/rtree.c
++++ b/ext/rtree/rtree.c
+@@ -900,7 +900,17 @@ static int nodeWrite(Rtree *pRtree, RtreeNode *pNode){
+ sqlite3_bind_null(p, 2);
+ if( pNode->iNode==0 && rc==SQLITE_OK ){
+ pNode->iNode = sqlite3_last_insert_rowid(pRtree->db);
+- nodeHashInsert(pRtree, pNode);
++ if( pNode->iNode==0 ){
++ /* If the SQL statement has succeeded but sqlite3_last_insert_rowid()
++ ** returns 0, then the shadow table schema has been corrupted somehow
++ ** (e.g. the %_node table has been replaced by a WITHOUT ROWID table).
++ ** It would be dangerous to continue in this case as the hash table
++ ** implementation assumes iNode==0 means that the node is not part
++ ** of the hash table. */
++ rc = SQLITE_CORRUPT_VTAB;
++ }else{
++ nodeHashInsert(pRtree, pNode);
++ }
+ }
+ }
+ return rc;
+diff --git a/ext/rtree/rtreeI.test b/ext/rtree/rtreeI.test
+index 0bc910e..142bb5e 100644
+--- a/ext/rtree/rtreeI.test
++++ b/ext/rtree/rtreeI.test
+@@ -15,6 +15,7 @@ if {![info exists testdir]} {
+ }
+ source [file join [file dirname [info script]] rtree_util.tcl]
+ source $testdir/tester.tcl
++set testprefix rtreeI
+ ifcapable !rtree { finish_test ; return }
+
+ # The following is a test of rowvalue handling on virtual tables that
+@@ -69,6 +70,36 @@ do_execsql_test rtreeI-1.51 {
+ SELECT 123 FROM t1, t2 WHERE 5>x1 AND 99>id AND (x0,0)<(a,0.5);
+ } {123}
+
++#-------------------------------------------------------------------------
++#
++reset_db
++do_execsql_test 2.0 {
++ PRAGMA page_size = 4096;
++ CREATE TABLE zero(x INTEGER PRIMARY KEY);
++ CREATE VIRTUAL TABLE t1 USING rtree(id, x1, x2, y1, y2);
++
++ WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<51)
++ INSERT INTO t1 SELECT i,i,i+1,i,i+1 FROM c;
++
++ CREATE TRIGGER tr BEFORE INSERT ON t1_node BEGIN
++ SELECT raise(IGNORE);
++ END;
++} {}
++
++db close
++sqlite3 db test.db
++
++do_execsql_test 2.1 {
++ PRAGMA integrity_check
++} {ok}
++
++do_catchsql_test 2.2 {
++ INSERT INTO t1 VALUES(1000, 0, 1, 0, 1);
++} {1 {database disk image is malformed}}
++
++do_execsql_test 2.3 {
++ SELECT * FROM t1 WHERE id=25
++} {25 25.0 26.0 25.0 26.0}
+
+
+ finish_test
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119379.patch b/sqlite-3.51.2-CVE-2026-119379.patch
new file mode 100644
index 0000000..eda9996
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119379.patch
@@ -0,0 +1,63 @@
+From ecbbbe563c647219fd7aee74f877f9e3cb50b869 Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 15:29:33 +0100
+Subject: [PATCH 10/11] CVE-2026-119379
+
+---
+ ext/session/sqlite3session.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c
+index 175cacb..9025e66 100644
+--- a/ext/session/sqlite3session.c
++++ b/ext/session/sqlite3session.c
+@@ -5194,10 +5194,10 @@ static int sessionChangesetApply(
+ int schemaMismatch = 0;
+ int rc = SQLITE_OK; /* Return code */
+ const char *zTab = 0; /* Name of current table */
+- int nTab = 0; /* Result of sqlite3Strlen30(zTab) */
+ SessionApplyCtx sApply; /* changeset_apply() context object */
+ int bPatchset;
+ u64 savedFlag = db->flags & SQLITE_FkNoAction;
++ int bNew = 0; /* True for first entry of new table */
+
+ assert( xConflict!=0 );
+
+@@ -5218,15 +5218,16 @@ static int sessionChangesetApply(
+ if( rc==SQLITE_OK ){
+ rc = sqlite3_exec(db, "PRAGMA defer_foreign_keys = 1", 0, 0, 0);
+ }
+- while( rc==SQLITE_OK && SQLITE_ROW==sqlite3changeset_next(pIter) ){
++ while( rc==SQLITE_OK && SQLITE_ROW==sessionChangesetNext(pIter, 0, 0,&bNew) ){
+ int nCol;
+ int op;
+ const char *zNew;
+
+ sqlite3changeset_op(pIter, &zNew, &nCol, &op, 0);
+
+- if( zTab==0 || sqlite3_strnicmp(zNew, zTab, nTab+1) ){
++ if( bNew ) {
+ u8 *abPK;
++ bNew = 0;
+
+ rc = sessionRetryConstraints(
+ db, pIter->bPatchset, zTab, &sApply, xConflict, pCtx
+@@ -5261,7 +5262,6 @@ static int sessionChangesetApply(
+ rc = SQLITE_NOMEM;
+ break;
+ }
+- nTab = (int)strlen(zTab);
+ sApply.azCol = (const char **)zTab;
+ }else{
+ int nMinCol = 0;
+@@ -5314,7 +5314,6 @@ static int sessionChangesetApply(
+ sApply.bStat1 = 0;
+ }
+ }
+- nTab = sqlite3Strlen30(zTab);
+ }
+ }
+
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119586.patch b/sqlite-3.51.2-CVE-2026-119586.patch
new file mode 100644
index 0000000..ceb7392
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119586.patch
@@ -0,0 +1,447 @@
+From 5561eef712cc031eb932552f887846c4f631d8a9 Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Thu, 19 Nov 2026 17:47:38 +0100
+Subject: [PATCH] sqlite-3.51.2-CVE-2026-119586
+
+---
+ ext/recover/sqlite3recover.c | 54 ++++++++++++++++++--
+ src/prepare.c | 5 +-
+ src/shell.c.in | 85 ++++++++++++++++++++++++++++++-
+ test/parser1.test | 34 +++++++++++++
+ test/recover.test | 96 ++++++++++++++++++++++++++++++++++++
+ 5 files changed, 268 insertions(+), 6 deletions(-)
+
+diff --git a/ext/recover/sqlite3recover.c b/ext/recover/sqlite3recover.c
+index d50aa25..154dadb 100644
+--- a/ext/recover/sqlite3recover.c
++++ b/ext/recover/sqlite3recover.c
+@@ -551,6 +551,26 @@ static int recoverExec(sqlite3_recover *p, sqlite3 *db, const char *zSql){
+ return p->errCode;
+ }
+
++/*
++** Run a single SQL statement in zSql. If zSql contains two or more
++** SQL statements separated by ';', only the first is run.
++**
++** Return the sqlite3_finalize() or sqlite3_prepare() result code
++** from running the zSql statement.
++*/
++static int recoverOneStmt(sqlite3 *db, const char *zSql, const char **pzTail){
++ sqlite3_stmt *pStmt = 0;
++ int rc;
++ if( zSql==0 ) return SQLITE_OK;
++ rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, pzTail);
++ if( rc ){
++ sqlite3_finalize(pStmt);
++ return rc;
++ }
++ while( SQLITE_ROW==sqlite3_step(pStmt) ){}
++ return sqlite3_finalize(pStmt);
++}
++
+ /*
+ ** Bind the value pVal to parameter iBind of statement pStmt. Leave an
+ ** error in the recover handle passed as the first argument if an error
+@@ -1170,7 +1190,7 @@ static int recoverWriteSchema1(sqlite3_recover *p){
+ ")"
+ "SELECT rootpage, tbl, isVirtual, name, sql"
+ " FROM dbschema "
+- " WHERE tbl OR isIndex"
++ " WHERE (tbl OR isIndex) AND sql GLOB 'CREATE *'"
+ " ORDER BY tbl DESC, name=='sqlite_sequence' DESC"
+ );
+
+@@ -1189,6 +1209,7 @@ static int recoverWriteSchema1(sqlite3_recover *p){
+ const char *zSql = (const char*)sqlite3_column_text(pSelect, 4);
+ char *zFree = 0;
+ int rc = SQLITE_OK;
++ const char *zTail = 0;
+
+ if( bVirtual ){
+ zSql = (const char*)(zFree = recoverMPrintf(p,
+@@ -1196,8 +1217,19 @@ static int recoverWriteSchema1(sqlite3_recover *p){
+ zName, zName, zSql
+ ));
+ }
+- rc = sqlite3_exec(p->dbOut, zSql, 0, 0, 0);
++ rc = recoverOneStmt(p->dbOut, zSql, &zTail);
+ if( rc==SQLITE_OK ){
++ char *pToFree = 0;
++ if( zTail && zTail[0] ){
++ /* Only the first statement is written to the output. Any
++ ** text that follows might contain hostile dot-commands that
++ ** would be run by a second instance of the shell if the
++ ** output of ".recover" were piped into it. */
++ int n = (int)(zTail - zSql);
++ while( n>0 && (zSql[n-1]==';' || zSql[n-1]<=' ') ){ n--; }
++ pToFree = sqlite3_mprintf("%.*s", n, zSql);
++ zSql = pToFree;
++ }
+ recoverSqlCallback(p, zSql);
+ if( bTable && !bVirtual ){
+ if( SQLITE_ROW==sqlite3_step(pTblname) ){
+@@ -1206,6 +1238,7 @@ static int recoverWriteSchema1(sqlite3_recover *p){
+ }
+ recoverReset(p, pTblname);
+ }
++ sqlite3_free(pToFree);
+ }else if( rc!=SQLITE_ERROR ){
+ recoverDbError(p, p->dbOut);
+ }
+@@ -1238,17 +1271,32 @@ static int recoverWriteSchema2(sqlite3_recover *p){
+ p->bSlowIndexes ?
+ "SELECT rootpage, sql FROM recovery.schema "
+ " WHERE type!='table' AND type!='index'"
++ " AND sql GLOB 'CREATE *'"
+ :
+ "SELECT rootpage, sql FROM recovery.schema "
+ " WHERE type!='table' AND (type!='index' OR sql NOT LIKE '%unique%')"
++ " AND sql GLOB 'CREATE *'"
+ );
+
+ if( pSelect ){
+ while( sqlite3_step(pSelect)==SQLITE_ROW ){
+ const char *zSql = (const char*)sqlite3_column_text(pSelect, 1);
+- int rc = sqlite3_exec(p->dbOut, zSql, 0, 0, 0);
++ const char *zTail = 0;
++ int rc = recoverOneStmt(p->dbOut, zSql, &zTail);
+ if( rc==SQLITE_OK ){
++ char *pToFree = 0;
++ if( zTail && zTail[0] ){
++ /* Only the first statement is written to the output. Any
++ ** text that follows might contain hostile dot-commands that
++ ** would be run by a second instance of the shell if the
++ ** output of ".recover" were piped into it. */
++ int n = (int)(zTail - zSql);
++ while( n>0 && (zSql[n-1]==';' || zSql[n-1]<=' ') ){ n--; }
++ pToFree = sqlite3_mprintf("%.*s", n, zSql);
++ zSql = pToFree;
++ }
+ recoverSqlCallback(p, zSql);
++ sqlite3_free(pToFree);
+ }else if( rc!=SQLITE_ERROR ){
+ recoverDbError(p, p->dbOut);
+ }
+diff --git a/src/prepare.c b/src/prepare.c
+index 539360b..d5df114 100644
+--- a/src/prepare.c
++++ b/src/prepare.c
+@@ -127,6 +127,7 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
+ int rc;
+ u8 saved_iDb = db->init.iDb;
+ sqlite3_stmt *pStmt;
++ const char *zEnd;
+ TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
+
+ assert( db->init.busy );
+@@ -141,7 +142,7 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
+ db->init.orphanTrigger = 0;
+ db->init.azInit = (const char**)argv;
+ pStmt = 0;
+- TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0);
++ TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, &zEnd);
+ rc = db->errCode;
+ assert( (rc&0xFF)==(rcp&0xFF) );
+ db->init.iDb = saved_iDb;
+@@ -157,6 +158,8 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
+ corruptSchema(pData, argv, sqlite3_errmsg(db));
+ }
+ }
++ }else if( zEnd[0] ){
++ corruptSchema(pData, argv, 0);
+ }
+ db->init.azInit = sqlite3StdType; /* Any array of string ptrs will do */
+ sqlite3_finalize(pStmt);
+diff --git a/src/shell.c.in b/src/shell.c.in
+index bd4483f..0552428 100644
+--- a/src/shell.c.in
++++ b/src/shell.c.in
+@@ -1496,6 +1496,7 @@ typedef struct ColModeOpts {
+ typedef struct ShellState ShellState;
+ struct ShellState {
+ sqlite3 *db; /* The database */
++ sqlite3 *dbScratch; /* Empty db used to validate schema in ".dump" */
+ u8 autoExplain; /* Automatically turn on .explain mode */
+ u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to each SQL stmt */
+ u8 autoEQPtest; /* autoEQP is in test mode */
+@@ -2538,6 +2539,51 @@ static void printSchemaLineN(FILE *out, char *z, int n, const char *zTail){
+ z[n] = c;
+ }
+
++/*
++** zSql contains the "sql" field of an entry of the sqlite_schema table
++** of a database that might be corrupt or hostile. This routine uses
++** database handle db - which should be a private in-memory database
++** used only for this purpose - to prepare and run the first SQL
++** statement in zSql. It then returns a pointer to a string obtained
++** from sqlite3_mprintf() that contains just that first statement, with
++** any trailing semicolon and whitespace removed. Any text that follows
++** the first statement is omitted, since such text might contain
++** dot-commands that would be run by a second instance of the shell if
++** the output of ".dump" or ".recover" were piped into it.
++**
++** Each schema statement is run against db, so that objects are created
++** there in dependency order. A CREATE TRIGGER statement can then be
++** prepared after the table to which it refers has been created, for
++** example.
++**
++** If zSql is NULL, or if it does not begin with a valid SQL statement,
++** or if an error occurs while running it, then NULL is returned and
++** the caller should omit the schema entry altogether.
++*/
++static char *shellFirstStmt(sqlite3 *db, const char *zSql){
++ sqlite3_stmt *pStmt = 0;
++ const char *zTail = 0;
++ char *zRet = 0;
++ int rc;
++ if( zSql==0 ) return 0;
++ rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zTail);
++ if( rc==SQLITE_OK && pStmt ){
++ while( SQLITE_ROW==sqlite3_step(pStmt) ){}
++ rc = sqlite3_finalize(pStmt);
++ pStmt = 0;
++ if( rc==SQLITE_OK && zTail ){
++ int n = (int)(zTail - zSql);
++ while( n>0 && (zSql[n-1]==';' || zSql[n-1]<=' ') ){ n--; }
++ if( n>0 ){
++ zRet = sqlite3_mprintf("%.*s", n, zSql);
++ shell_check_oom(zRet);
++ }
++ }
++ }
++ sqlite3_finalize(pStmt);
++ return zRet;
++}
++
+ /*
+ ** Return true if string z[] has nothing but whitespace and comments to the
+ ** end of the first line.
+@@ -3299,11 +3345,24 @@ static int run_table_dump_query(
+ rc = sqlite3_step(pSelect);
+ nResult = sqlite3_column_count(pSelect);
+ while( rc==SQLITE_ROW ){
++ const char *zPrint;
++ char *zFree = 0;
+ z = (const char*)sqlite3_column_text(pSelect, 0);
+- sqlite3_fprintf(p->out, "%s", z);
++ if( nResult==1 && z && sqlite3_strnicmp(z, "create ", 7)==0 ){
++ /* Only schema statements that consist of a single CREATE statement
++ ** are written to the output. Anything else might be an attempt to
++ ** inject hostile dot-commands into the output of this command. */
++ zFree = shellFirstStmt(p->dbScratch, z);
++ if( zFree==0 ){ rc = sqlite3_step(pSelect); continue; }
++ zPrint = zFree;
++ }else{
++ zPrint = z;
++ }
++ sqlite3_fprintf(p->out, "%s", zPrint);
+ for(i=1; i<nResult; i++){
+ sqlite3_fprintf(p->out, ",%s", sqlite3_column_text(pSelect, i));
+ }
++ z = zPrint;
+ if( z==0 ) z = "";
+ while( z[0] && (z[0]!='-' || z[1]!='-') ) z++;
+ if( z[0] ){
+@@ -3311,6 +3370,7 @@ static int run_table_dump_query(
+ }else{
+ sqlite3_fputs(";\n", p->out);
+ }
++ sqlite3_free(zFree);
+ rc = sqlite3_step(pSelect);
+ }
+ rc = sqlite3_finalize(pSelect);
+@@ -5028,7 +5088,16 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){
+ sqlite3_free(zIns);
+ return 0;
+ }else{
+- printSchemaLine(p->out, zSql, ";\n");
++ /* Only schema statements that consist of a single CREATE statement
++ ** are written to the output. Anything else might be an attempt to
++ ** inject hostile dot-commands into the output of this command. */
++ char *zFirst = 0;
++ if( sqlite3_strnicmp(zSql, "create ", 7)==0 ){
++ zFirst = shellFirstStmt(p->dbScratch, zSql);
++ }
++ if( zFirst==0 ) return 0;
++ printSchemaLine(p->out, zFirst, ";\n");
++ sqlite3_free(zFirst);
+ }
+
+ if( cli_strcmp(zType, "table")==0 ){
+@@ -9227,6 +9296,16 @@ static int do_meta_command(char *zLine, ShellState *p){
+ ** as much of the schema as it can even if the sqlite_schema table is
+ ** corrupt. */
+ sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0);
++ /* Open an empty database handle. Schema statements are run against
++ ** this handle before being written to the output stream, so that
++ ** only statements that consist of a single CREATE are output. See
++ ** shellFirstStmt(). */
++ sqlite3_close(p->dbScratch);
++ p->dbScratch = 0;
++ if( sqlite3_open(":memory:", &p->dbScratch) ){
++ sqlite3_close(p->dbScratch);
++ p->dbScratch = 0;
++ }
+ p->nErr = 0;
+ if( zLike==0 ) zLike = sqlite3_mprintf("true");
+ zSql = sqlite3_mprintf(
+@@ -9256,6 +9335,8 @@ static int do_meta_command(char *zLine, ShellState *p){
+ }
+ sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0);
+ sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0);
++ sqlite3_close(p->dbScratch);
++ p->dbScratch = 0;
+ if( (p->shellFlgs & SHFLG_DumpDataOnly)==0 ){
+ sqlite3_fputs(p->nErr?"ROLLBACK; -- due to errors\n":"COMMIT;\n", p->out);
+ }
+diff --git a/test/parser1.test b/test/parser1.test
+index b8d3d8b..0b50f82 100644
+--- a/test/parser1.test
++++ b/test/parser1.test
+@@ -122,4 +122,38 @@ do_execsql_test parser1-4.4 {
+ } 1
+
+
++# 2026-11-18
++#
++# Do not allow surplus SQL text to appear after the CREATE statement
++# in the sqlite_schema.sql field. Such text might contain hostile
++# dot-commands that would be run if the output of ".dump" or ".recover"
++# were piped into a second instance of the shell.
++#
++# Correct behavior is to raise an error if PRAGMA writable_schema is
++# not engaged.
++#
++reset_db
++do_execsql_test parser1-5.1 {
++ CREATE TABLE t1(a,b,c);
++ CREATE INDEX t1a ON t1(a);
++ INSERT INTO t1 VALUES(1,2,3),('x','y','z');
++ PRAGMA integrity_check;
++} {ok}
++do_execsql_test parser1-5.2 {
++ PRAGMA writable_schema=on;
++ UPDATE sqlite_schema SET sql=sql||'; SELECT ''hi!''' WHERE name='t1';
++} {}
++db close
++do_test parser1-5.3 {
++ catch {sqlite3 db test.db} msg
++ set msg
++} {}
++do_catchsql_test parser1-5.4 {
++ PRAGMA integrity_check;
++} {1 {malformed database schema (t1)}}
++do_execsql_test parser1-5.5 {
++ PRAGMA writable_schema=ON;
++ PRAGMA integrity_check;
++} {ok}
++
+ finish_test
+diff --git a/test/recover.test b/test/recover.test
+index ad6b729..e35cbcf 100644
+--- a/test/recover.test
++++ b/test/recover.test
+@@ -179,4 +179,100 @@ do_execsql_test -db db2 4.2.2 {
+ } {one two three}
+ db2 close
+
++#-------------------------------------------------------------------------
++# 2026-11-18
++#
++# Ensure that ".recover" and ".dump" do not copy surplus text that follows
++# the first SQL statement of a sqlite_schema.sql field into their output.
++# Such text might contain hostile dot-commands that would be run by a
++# second instance of the shell if the output were piped into it.
++#
++reset_db
++do_execsql_test 5.0 {
++ CREATE TABLE t1(a, b);
++ INSERT INTO t1 VALUES(1, 2);
++ PRAGMA writable_schema = on;
++ UPDATE sqlite_schema SET sql =
++ 'CREATE TABLE t1(a, b);
++.shell echo boom' WHERE name = 't1';
++} {}
++do_test 5.1 {
++ set fd [open "|$::CLI test.db .recover"]
++ set sql [read $fd]
++ close $fd
++ set sql
++} {.dbconfig defensive off
++BEGIN;
++PRAGMA writable_schema = on;
++PRAGMA foreign_keys = off;
++PRAGMA encoding = 'UTF-8';
++PRAGMA page_size = '1024';
++PRAGMA auto_vacuum = '0';
++PRAGMA user_version = '0';
++PRAGMA application_id = '0';
++CREATE TABLE t1(a, b);
++INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (1, 1, 2);
++PRAGMA writable_schema = off;
++COMMIT;}
++do_test 5.2 {
++ # The shell runs with defensive mode on by default. In that mode
++ # PRAGMA writable_schema is a no-op, so ".dump" of this database
++ # fails at the schema-load check instead of writing any schema.
++ set fd [open "|$::CLI test.db .dump 2>/dev/null"]
++ set sql [read $fd]
++ close $fd
++ set sql
++} {PRAGMA foreign_keys=OFF;
++BEGIN TRANSACTION;
++/****** CORRUPTION ERROR *******/
++/****** malformed database schema (t1) ******/
++/****** ERROR: near "ORDER": syntax error ******/
++/**** ERROR: (11) malformed database schema (t1) *****/
++COMMIT;}
++do_test 5.5 {
++ # With defensive mode disabled, ".dump" writes the schema, but only
++ # the first statement of each schema entry.
++ set f [open dbinit.txt w]
++ puts $f ".dbconfig defensive off"
++ close $f
++ set fd [open "|$::CLI -init dbinit.txt test.db .dump 2>/dev/null"]
++ set sql [read $fd]
++ close $fd
++ set sql
++} { defensive off
++PRAGMA foreign_keys=OFF;
++BEGIN TRANSACTION;
++CREATE TABLE t1(a, b);
++INSERT INTO t1 VALUES(1,2);
++COMMIT;}
++
++# A schema entry of type 'view' is handled by a second emit path within
++# the recovery extension. Check that one too.
++#
++reset_db
++do_execsql_test 5.3 {
++ CREATE VIEW vv AS SELECT 1;
++ PRAGMA writable_schema = on;
++ UPDATE sqlite_schema SET sql =
++ 'CREATE VIEW vv AS SELECT 1;
++.shell echo boom' WHERE name = 'vv';
++} {}
++do_test 5.4 {
++ set fd [open "|$::CLI test.db .recover"]
++ set sql [read $fd]
++ close $fd
++ set sql
++} {.dbconfig defensive off
++BEGIN;
++PRAGMA writable_schema = on;
++PRAGMA foreign_keys = off;
++PRAGMA encoding = 'UTF-8';
++PRAGMA page_size = '1024';
++PRAGMA auto_vacuum = '0';
++PRAGMA user_version = '0';
++PRAGMA application_id = '0';
++CREATE VIEW vv AS SELECT 1;
++PRAGMA writable_schema = off;
++COMMIT;}
++
+ finish_test
+--
+2.56.1
+
diff --git a/sqlite-3.51.2-CVE-2026-119591.patch b/sqlite-3.51.2-CVE-2026-119591.patch
new file mode 100644
index 0000000..886a2c5
--- /dev/null
+++ b/sqlite-3.51.2-CVE-2026-119591.patch
@@ -0,0 +1,27 @@
+From 26aeb64d94501959b06d6eef03c85cdb9d8f4eac Mon Sep 17 00:00:00 2001
+From: Petr Khartskhaev <pkhartsk@redhat.com>
+Date: Wed, 18 Nov 2026 15:31:04 +0100
+Subject: [PATCH 11/11] CVE-2026-119591
+
+---
+ src/select.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/select.c b/src/select.c
+index 4e19ea2..4c0f6aa 100644
+--- a/src/select.c
++++ b/src/select.c
+@@ -7302,6 +7302,10 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
+ }else{
+ pExpr = sqlite3PExpr(pParse, TK_PLUS, pTerm, pExpr);
+ }
++ if( pParse->nErr ){
++ sqlite3ExprDelete(db, pExpr);
++ pExpr = 0;
++ }
+ pSub = pPrior;
+ }
+ p->pEList->a[0].pExpr = pExpr;
+--
+2.56.1
+
diff --git a/sqlite.spec b/sqlite.spec
index af304c2..da246aa 100644
--- a/sqlite.spec
+++ b/sqlite.spec
@@ -13,7 +13,7 @@
Summary: Library that implements an embeddable SQL database engine
Name: sqlite
Version: %{rpmver}
-Release: 2%{?dist}
+Release: 3%{?dist}
License: blessing
URL: http://www.sqlite.org/
@@ -24,6 +24,30 @@ Source2: http://www.sqlite.org/%{year}/sqlite-autoconf-%{realver}.tar.gz
Patch1: sqlite-3.6.23-lemon-system-template.patch
Patch2: sqlite-3.49.0-fix-lemon-missing-cflags.patch
Patch3: sqlite-3.51.2-CVE-2026-11822-CVE-2026-11824.patch
+# https://sqlite.org/src/info/f54730871303e655 and https://sqlite.org/src/info/3f3fb9b638
+Patch4: sqlite-3.51.2-CVE-2026-119371.patch
+# https://sqlite.org/src/info/e4635c4153
+Patch5: sqlite-3.51.2-CVE-2026-119372.patch
+# https://sqlite.org/src/info/a7f8c92f62
+Patch6: sqlite-3.51.2-CVE-2026-119373.patch
+# https://sqlite.org/src/info/9cd4f9e920
+Patch7: sqlite-3.51.2-CVE-2026-119374.patch
+# https://sqlite.org/src/info/f9b4ee369557c36c
+Patch8: sqlite-3.51.2-CVE-2026-119375.patch
+# https://sqlite.org/src/info/252c0b7bf5a727d2
+Patch9: sqlite-3.51.2-CVE-2026-119376.patch
+# https://sqlite.org/src/info/4ef88a36f9 and https://sqlite.org/src/info/bbd69ce274620008
+# and https://sqlite.org/src/info/2cb22877683680c1
+Patch10: sqlite-3.51.2-CVE-2026-119377.patch
+# https://sqlite.org/src/info/6a9e1415659f9e75
+Patch11: sqlite-3.51.2-CVE-2026-119378.patch
+# https://sqlite.org/src/info/3f57024aecea0f3b
+Patch12: sqlite-3.51.2-CVE-2026-119379.patch
+# Different part of code vulnerable to upstream, but the same attack vector is possible
+# Custom patch
+Patch13: sqlite-3.51.2-CVE-2026-119586.patch
+# https://sqlite.org/src/info/ab621a3e11ee4acc
+Patch14: sqlite-3.51.2-CVE-2026-119591.patch
BuildRequires: make
BuildRequires: gcc gcc-c++
@@ -173,6 +197,17 @@ This package contains the analysis program for %{name}.
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
+%patch -P 4 -p1
+%patch -P 5 -p1
+%patch -P 6 -p1
+%patch -P 7 -p1
+%patch -P 8 -p1
+%patch -P 9 -p1
+%patch -P 10 -p1
+%patch -P 11 -p1
+%patch -P 12 -p1
+%patch -P 13 -p1
+%patch -P 14 -p1
# The atof test is failing on the i686 architecture, when binary configured with
# --enable-rtree option. Failing part is text->real conversion and
@@ -352,6 +387,10 @@ make test
%endif
%changelog
+* Wed Nov 18 2026 Petr Khartskhaev <pkhartsk@redhat.com> - 3.51.2-3
+- Fix CVE-2026-119371, CVE-2026-119372, CVE-2026-119373, CVE-2026-119374, CVE-2026-119375,
+ CVE-2026-119376, CVE-2026-119377, CVE-2026-119378, CVE-2026-119379, CVE-2026-119586, CVE-2026-119591
+
* Mon Aug 10 2026 Petr Khartskhaev <pkhartsk@redhat.com> - 3.51.2-2
- Fix CVE-2026-11822 and CVE-2026-11824
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-20 10:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 10:13 [rpms/sqlite] f44: Fixes CVE-2026-119371, CVE-2026-119372, CVE-2026-119373, CVE-2026-119374, CVE-2026-119375, CVE-2026-119376, CVE-2026-119377, CVE-2026-119378, CVE-2026-119379, CVE-2026-119586, CVE-2026-119591 Petr Khartskhaev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox