Detect overflow in flo_shift().

This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-11-17 14:38:15 +09:00
parent 9fbf0ef886
commit a8cd364ece
+3 -1
View File
@@ -610,7 +610,9 @@ flo_shift(mrb_state *mrb, mrb_value x, mrb_int width)
val *= 2;
}
}
return mrb_int_value(mrb, (mrb_int)val);
if (FIXABLE_FLOAT(val))
return mrb_int_value(mrb, (mrb_int)val);
return mrb_float_value(mrb, val);
}
static mrb_value