Bug 2552464

Summary: sqlite: sqlite: stack overflow via VALUES clause with WITH and UNION ALL fallback
Product: [Other] Security Response Reporter: OSIDB Bzimport <bzimport>
Component: vulnerability-draftAssignee: Product Security DevOps Team <prodsec-dev>
Status: NEW --- QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: akhatavk, aos-team-art-private, asdas, bbrownin, dpaolell, jdelft, jupierce, lgarciaa, mbiarnes, ppalepu, ppostler, prdhamdh, rhel-process-autobot, sghai, sidsharm, suppawar, vlaad, watson-tool-maintainers
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
A flaw was found in SQLite's SQL parser. A VALUES clause with many rows combined with a WITH (CTE) clause forces a UNION ALL compound-SELECT fallback path. The compound-SELECT depth limit is bypassed when the SF_Values flag is set, allowing an arbitrarily deep AST. When expression depth limits reject the tree, the recursive cleanup in clearSelect() can overflow the stack, leading to denial of service (crash).
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2553514, 2553516, 2553517, 2553518, 2553520, 2553521, 2553512    
Bug Blocks:    

Description OSIDB Bzimport 2026-10-14 16:14:05 UTC
A vulnerability was found in SQLite's SQL parser. A VALUES clause with many rows combined with a WITH (CTE) clause forces a UNION ALL compound-SELECT fallback. The compound-SELECT depth limit is bypassed when SF_Values is set, creating an arbitrarily deep AST. When expression depth limits reject the tree, recursive cleanup could overflow the stack. The fix makes clearSelect() iterate the pPrior chain instead of recursing.

PoC: https://github.com/abraxas/sqlite-values-union

Fixed in SQLite 3.54.0 (fix in src/select.c — clearSelect() now iterative).