summaryrefslogtreecommitdiffhomepage
path: root/vm.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-06-27 15:36:09 +0200
committerJo-Philipp Wich <jo@mein.io>2022-06-27 15:43:09 +0200
commit9a2e59272dd138e5aece3ef5fbbcbac6ebadd23b (patch)
tree4adc9125288a5a428454765442514ff56d61a0e3 /vm.c
parent44bf33a2701d7cf94ae0a41f6befc7f591913e10 (diff)
compiler: fix stack mismatch on nonmatching switch statements with locals
When a switch statement containing cases with local variable declarations and no default case is evalulated and none of the the cases matched, the local variable slots were never initialized but got popped off the stack when execution resumed after the switch scope, leading to a mismatch in stack layout between compiler and runtime, causing local variables to yield wrong values or a stack underflow triggering a segmentation fault. Solve this issue by patching the last conditional case match jump to hop beyond the local variable pop instructions when no default case is defined. Also extend the regression test case dealing with other switch related stack mismatch issues to cover this particular problem as well. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'vm.c')
0 files changed, 0 insertions, 0 deletions