Commit graph

4 commits

Author SHA1 Message Date
Ruud van Asseldonk
bb34ecb643 Adjust stack depth counter again to avoid overflow
The bad input 3 was discovered by the fuzzer after I did the expansion.
I fixed it by lowering the limit, then it immediately discovered input
4 which had the same structure. So the right solution here is to add
more depth counters. It might mean that we double-count function calls,
but it does help.
2024-02-24 21:54:35 +01:00
Ruud van Asseldonk
240bb04bf1 Guard against stack overflow in more places
This is still not exhaustive, but it at least guards against some cases
discovered by the fuzzer.

Tail calls would likely solve this, though maybe even that is not
enough, you _could_ overflow the native stack with a very deeply nested
expression. The eventual solution might be to have a bytecode
interpreter with jumps, but for now, let's patch it ad-hoc ...
2023-12-29 17:31:53 +01:00
Ruud van Asseldonk
e30f203efe Raise error if the call depth is too deep
This prevents overflowing the native stack; show a friendly message
instaed.
2023-12-17 22:38:52 +01:00
Ruud van Asseldonk
92f74f66dc Add test case for stack overflow
I discovered this while trying to implement and Advent of Code problem
in RCL. Everything appears to work, except that it overflows its stack.
This is tough to solve, but at least we can make it error niceley
instead of crashing. I am a bit disappointed that the fuzzer has not
discovered this yet.
2023-12-17 22:38:52 +01:00