Terminate float right shift if shift value is too big.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-05-16 09:51:27 +09:00
parent 6af0effda1
commit 752edf413f
+4
View File
@@ -484,6 +484,10 @@ flo_shift(mrb_state *mrb, mrb_value x, mrb_int width)
if (width < 0) {
while (width++) {
val /= 2;
if (val < 1.0) {
val = 0;
break;
}
}
#if defined(_ISOC99_SOURCE)
val = trunc(val);