mrb_get_args(i) should check range of float values

This commit is contained in:
Yukihiro Matsumoto
2012-06-14 00:03:36 +09:00
parent a58761787b
commit 6f670785c5
+8 -1
View File
@@ -542,7 +542,14 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
*p = mrb_fixnum(*sp);
break;
case MRB_TT_FLOAT:
*p = (mrb_int)mrb_float(*sp);
{
mrb_float f = mrb_float(*sp);
if (!FIXABLE(f)) {
mrb_raise(mrb, E_RANGE_ERROR, "float too big for int");
}
*p = (mrb_int)f;
}
break;
case MRB_TT_FALSE:
*p = 0;