Never crash: scripts nested too deeply return an error instead of overflowing the stack

Scripts (Script Console, effectcraft-cli script, the MCP run_script tool) are parsed by Boa,
which recurses per nesting level and overflows the stack (aborting the app) at about 200
levels on an 8 MiB thread. run() now rejects a script nested deeper than MAX_NESTING (96)
brackets with a ScriptError before parsing; strings, template literals and comments are
skipped. Also replaces expect("console context") with an error, and denies the panic lints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-04 13:26:05 -04:00
co-authored by Claude Opus 5.5
parent 10644a83aa
commit f8460971f0
3 changed files with 84 additions and 1 deletions
+1
View File
@@ -49,6 +49,7 @@
//! the `script.run` command, File ▸ Scripts ▸ Run Script File… (`.jsx`/`.js`), the Script Console
//! panel, `effectcraft-cli script` and the MCP `run_script` tool use.
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
#![recursion_limit = "256"]
pub mod matchnames;