codegen.c: avoid division by zero in constant folding.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-08-03 15:57:01 +09:00
parent fad47a98a7
commit 2092bc7fe8
+1 -1
View File
@@ -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) {