Guard against two DoS crashes: parser recursion depth and integer div/mod by zero - #92
Open
stratomarco wants to merge 1 commit into
Open
stratomarco wants to merge 1 commit into
stratomarco wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
stratomarco
added a commit
to stratomarco/mapfuzz
that referenced
this pull request
Sep 4, 2026
…oth are in public PR google/minja#92 (open, CLA-blocked since 2026-08-14), not embargoed; 0004 recursion independently disclosed publicly by another researcher (public prior art, not novel); note llama.cpp migrating off minja; fix stale PRIVATE_findings refs to the public PR URL; drop 'reproducer withheld' framing contradicted by the open PR
…/mod by zero
Add a recursion depth cap in Parser::parseExpression. Deeply-nested expressions
previously recursed through the expression-precedence chain without bound and
exhausted the stack (SIGSEGV at parse time). jinja2 guards recursion here.
Guard integer division and modulo against a zero divisor at all sites (the
BinaryOpExpr evaluation switch and the Value operators). Previously {{ 1/0 }},
{{ 5//0 }} or {{ x%0 }} crashed with SIGFPE at render time.
Both throw std::runtime_error, consistent with existing error handling. Verified
against 239 real chat templates (unchanged) and normal arithmetic
(1+2*3=7, 10%3=1, 8/2=4). Found via coverage-guided fuzzing.
stratomarco
force-pushed
the
fix-dos-recursion-divzero
branch
from
September 4, 2026 23:27
050a23d to
28c9e15
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a recursion depth cap in Parser::parseExpression. Deeply-nested expressions
previously recursed through the expression-precedence chain without bound and
exhausted the stack (SIGSEGV at parse time). jinja2 guards recursion here.
Guard integer division and modulo against a zero divisor at all sites (the
BinaryOpExpr evaluation switch and the Value operators). Previously {{ 1/0 }},
{{ 5//0 }} or {{ x%0 }} crashed with SIGFPE at render time.
Both throw std::runtime_error, consistent with existing error handling. Verified
against 239 real chat templates (unchanged) and normal arithmetic
(1+2*3=7, 10%3=1, 8/2=4). Found via coverage-guided fuzzing."