summaryrefslogtreecommitdiffhomepage
path: root/compiler.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-04-29 00:08:55 +0200
committerJo-Philipp Wich <jo@mein.io>2021-04-29 00:11:02 +0200
commit86b4863837edbd9aaac1aeea3f0101076ef55f09 (patch)
treebfab75f75117de86bc805b461c68b05b402818a3 /compiler.c
parent0e245093909c0445267187b1f396630301965f1a (diff)
compiler: fix segfault on parsing invalid pre/post increment expressions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler.c b/compiler.c
index c5cfef5..8c30d84 100644
--- a/compiler.c
+++ b/compiler.c
@@ -820,7 +820,7 @@ uc_compiler_emit_inc_dec(uc_compiler *compiler, uc_tokentype_t toktype, bool is_
uint32_t cidx = 0;
/* determine kind of emitted load instruction and operand value (if any) */
- type = chunk->entries[compiler->last_insn];
+ type = chunk->entries ? chunk->entries[compiler->last_insn] : 0;
if (type == I_LVAR || type == I_LLOC || type == I_LUPV) {
cidx = uc_compiler_get_u32(compiler, compiler->last_insn + 1);