Unbounded recursion causes non-catchable stack overflow (process abort) during parse and render #23
Labels
No labels
automated-🤖
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Hemera/nomo#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Both the parser and the evaluator recurse once per nesting level with no depth limit. A stack overflow is a hard
SIGABRTthat cannot be intercepted withcatch_unwind.Verified on
main(default 8 MB stack):add_templatewith ~400 nested((debug) / ~1000-2000 (release) → abort. A 2-4 KB template is enough.add_templatewith deeply nestedif/forblocks (~2000 deep, release) → abort.renderwith ~1500 nested{{ define }}blocks → abort (eachdefineexecutesRenderInlinerecursively).renderof a template that renders itself (directly or mutually) → abort.Suggested mitigations:
parse_expression/ chain parsers and error out beyond a limit).run_executedepth / maxRender+RenderInlinenesting, returning anEvaluationError.render.