mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
codegen.c: detect integer overflow in division.
`MRB_INT_MIN / -1` overflows.
This commit is contained in:
@@ -791,6 +791,7 @@ gen_muldiv(codegen_scope *s, uint8_t op, uint16_t dst)
|
||||
if (mrb_int_mul_overflow(n0, n, &n)) goto normal;
|
||||
}
|
||||
else { /* OP_DIV */
|
||||
if (n0 == MRB_INT_MIN && n == -1) goto normal;
|
||||
n = n0 / n;
|
||||
}
|
||||
s->pc = addr_pc(s, data0.addr);
|
||||
|
||||
Reference in New Issue
Block a user