The vulnerability, CVE-2026-46374, is an uncontrolled resource consumption issue in the SQLFluff parser. An attacker could provide a specially crafted, large SQL query that would cause the parser to consume excessive memory and CPU, leading to a Denial of Service. This was possible because the parsing process, in both the Python and the experimental Rust implementations, did not have a limit on the number of nodes it could create in the parse tree.
The patch, introduced in version 4.2.0, mitigates this by adding a configurable limit, max_parse_nodes, which defaults to 100,000. The analysis of the patch commit 68321612f51ac62a6d04ab3e83d72d6f7cf29e36 reveals how this limit is enforced.
The core of the fix involves modifying the ParseContext to track the number of nodes created. The MatchResult.apply function, which is responsible for recursively building the parse tree, was updated to increment a counter and check it against the max_parse_nodes limit on each invocation. If the limit is exceeded, a SQLParseError is raised, terminating the parsing process.
The key vulnerable functions identified are the primary entry points and core recursive components of the parsing engine. Functions like Linter._parse_tokens and Parser.parse initiate the process, while MatchResult.apply is where the unbounded node creation occurred. The RustParser.parse function serves as the equivalent entry point for the Rust implementation, which received a parallel fix. During an exploit, these functions would be active on the stack, consuming resources until the system is exhausted.