summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-08-03 15:57:01 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-08-03 15:57:01 +0900
commit2092bc7fe8a1cb188acf6248764173c1ccbb9040 (patch)
treed113dad5045e0e215e0ac68f84031d62b3daca42 /mrbgems/mruby-compiler/core/codegen.c
parentfad47a98a7de4d560d8641f39eba2f3b18bfc7f3 (diff)
downloadmruby-2092bc7fe8a1cb188acf6248764173c1ccbb9040.tar.gz
mruby-2092bc7fe8a1cb188acf6248764173c1ccbb9040.zip
codegen.c: avoid division by zero in constant folding.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 467b70e1b..0a0620589 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -784,7 +784,7 @@ gen_muldiv(codegen_scope *s, uint8_t op, uint16_t dst)
goto normal;
}
struct mrb_insn_data data0 = mrb_decode_insn(mrb_prev_pc(s, data.addr));
- if (!get_int_operand(s, &data0, &n0)) {
+ if (!get_int_operand(s, &data0, &n0) || n == 0) {
goto normal;
}
if (op == OP_MUL) {