Support deep TeX numeric scans with bounded stack growth

This commit is contained in:
gloamxun committed 2026-11-21 14:34:55 +08:00
1 parent 7070cc6b82
commit dba73f1f47
9 files changed
+206 -47

No files matched your search

@@ -14,13 +14,9 @@ impl Executor {
files: &mut impl SourceProvider,
parenthesized: bool,
) -> Result<RegisterValue, Error> {
if self.expression_depth >= self.limits.input_depth.min(32) {
return self.fail("native expression nesting limit exceeded");
}
self.expression_depth += 1;
let result = self.quantity_expression_sum(kind, files, parenthesized);
self.expression_depth -= 1;
result
self.with_expression_scan(|executor| {
executor.quantity_expression_sum(kind, files, parenthesized)
})
}
fn quantity_expression_sum(
&mut self,