Commit Graph

1 Commits

Author SHA1 Message Date
Aleksi Salmela
5268170c89 fix: guard against local variable array overflow from for-loop hidden variables
Add a bounds check in `forStatement` to ensure there is space for the two hidden local variables (sequence slot and iterator) before calling `addLocal`. Without this check, deeply nested for-loops could overflow the `locals` array, causing a buffer overrun. The fix emits a clear compiler error when `numLocals + 2` exceeds `MAX_LOCALS`, and includes a regression test with 85 nested for-loops that previously triggered the overflow.
2018-06-12 21:31:28 +00:00