new file mode 100644
@@ -0,0 +1,40 @@
+From 0894e1c6c54cde37d822bd1cb367fd1ed2765732 Mon Sep 17 00:00:00 2001
+From: drh <>
+Date: Mon, 5 Oct 2026 12:18:23 +0000
+Subject: [PATCH] Prevent the expression generated by the count-of-view
+ optimization from getting too deep and causing a CPU stack overflow.
+ [bugs:/info/2026-10-04T05:34:47Z|Bug 2026-10-04T05:34:47Z]
+
+FossilOrigin-Name: ab621a3e11ee4accce14bf6c90a7cc273d9c25a7c3d9dd2466f2bdc2bbbf8084
+
+CVE: CVE-2026-119591
+Upstream-Status: Backport [https://github.com/sqlite/sqlite/commit/eff50a067c55f972909e7780e506e91382d08de2]
+
+Backport Changes:
+- Ported the src/select.c change into the amalgamated sqlite3.c.
+- Omitted manifest and manifest.uuid because they are Fossil metadata
+ and are not needed for this source layout.
+
+Signed-off-by: Arpit Patel <arpitpa@cisco.com>
+---
+ sqlite3.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sqlite3.c b/sqlite3.c
+index 19ab450812..f3f10400c4 100644
+--- a/sqlite3.c
++++ b/sqlite3.c
+@@ -154164,6 +154164,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.35.6
+
@@ -22,4 +22,5 @@ SRC_URI += "\
file://CVE-2026-119376.patch \
file://CVE-2026-119371-dependent.patch \
file://CVE-2026-119371.patch \
+ file://CVE-2026-119591.patch \
"
This patch applies the upstream fix [1] for stack exhaustion in the count-of-view optimization. The GitHub mirror commit [1] corresponds to the SQLite Fossil check-in shown in [2]. [1] https://github.com/sqlite/sqlite/commit/eff50a067c55f972909e7780e506e91382d08de2 [2] https://sqlite.org/src/info/ab621a3e11ee4acc Reference: https://nvd.nist.gov/vuln/detail/CVE-2026-119591 Signed-off-by: Arpit Patel <arpitpa@cisco.com> --- .../sqlite/sqlite3/CVE-2026-119591.patch | 40 +++++++++++++++++++ meta/recipes-support/sqlite/sqlite3_3.51.3.bb | 1 + 2 files changed, 41 insertions(+) create mode 100644 meta/recipes-support/sqlite/sqlite3/CVE-2026-119591.patch