numeric.c: check zero division before modulo.

parent caaa07f2
......@@ -1118,6 +1118,7 @@ int_mod(mrb_state *mrb, mrb_value x)
a = mrb_integer(x);
if (mrb_integer_p(y) && a != MRB_INT_MIN && (b=mrb_integer(y)) != MRB_INT_MIN) {
if (b == 0) int_zerodiv(mrb);
mrb_int mod = a % b;
if ((a < 0) != (b < 0) && mod != 0) {
mod += b;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment