Skip to content

fix(import-manim): bound every recursive parser production - #232

Merged
MemerGamer merged 1 commit into
v2from
v2-manim-parser-depth
Nov 14, 2026
Merged

MemerGamer merged 1 commit into
v2from
v2-manim-parser-depth

Conversation

@MemerGamer

Copy link
Copy Markdown
Member

Follow-up from the plugin API 1.1 agent (#230), which left this commit on a branch without a PR.

The new pure-Rust Python parser (replacing tree-sitter for wasm32) bounded only some recursive productions, and statement() reset the depth counter for each statement, so a hostile Manim script could exhaust the stack inside the importer sandbox. Depth is now counted on every recursive production and kept across nested statements, with a test per construct.

cargo test -p animathio-import-manim passes (34 tests).

🤖 Generated with Claude Code

The Python parser only counted bracket, unary and power nesting. Assignment
chains, `:=`, conditional expressions, `lambda` and nested blocks recursed
without a bound, and `statement()` reset the counter for every statement, so a
hostile script could exhaust the stack inside the importer sandbox. Count depth
on all of them, keep it across nested statements, and test each construct.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MemerGamer
MemerGamer merged commit 00d71e2 into v2 Nov 14, 2026
2 checks passed
@MemerGamer
MemerGamer deleted the v2-manim-parser-depth branch November 14, 2026 12:22
MemerGamer added a commit that referenced this pull request Nov 14, 2026
statement_inner recursed once per 'async' token without a depth check, so
'async async ...' could still exhaust the importer sandbox's stack after #232.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant