summaryrefslogtreecommitdiffhomepage
path: root/compiler.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-02-26 21:21:10 +0100
committerJo-Philipp Wich <jo@mein.io>2021-02-26 21:29:00 +0100
commit9ad9afb24d90cee643c35e254de0b1c734e44940 (patch)
tree71b2d7eeeebb332a1183c0f5ca7245b1ae77a0a0 /compiler.c
parent14aace988c32faa1829b6839825ab40d8efa3968 (diff)
compiler: fix try/catch miscompilation
When skipping catch blocks with exception variables, jump beyond the instruction popping the exception variable off the stack to fix a stack position mismatch between compiler and vm. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler.c b/compiler.c
index 3c6f6e1..436f91d 100644
--- a/compiler.c
+++ b/compiler.c
@@ -2485,9 +2485,9 @@ uc_compiler_compile_try(uc_compiler *compiler)
uc_compiler_parse_consume(compiler, TK_RBRACE);
- uc_compiler_set_jmpaddr(compiler, jmp_off, chunk->count);
-
uc_compiler_leave_scope(compiler);
+
+ uc_compiler_set_jmpaddr(compiler, jmp_off, chunk->count);
}
static void