fix: 配置限制递归层数解决死循环问题

This commit is contained in:
爱特每羊队
2026-06-07 19:27:48 +08:00
parent 3fce4a9663
commit 3e8b601121
2 changed files with 10 additions and 0 deletions
+6
View File
@@ -1145,6 +1145,12 @@ impl Vm {
));
}
if self.frames.len() >= self.kernel.config.max_call_depth {
return Err(
"RangeError: Maximum call stack size exceeded".into()
);
}
// Clone sub_module data before mutably borrowing self
let sub_bytecode = self.sub_modules[sub_idx].bytecode.clone();
let sub_n_args = self.sub_modules[sub_idx].n_args as usize;