Fix integer boundary check before float to time_t casting.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-02-12 11:54:32 +09:00
parent 736ea1f5c7
commit 0301d8a89b
+1 -1
View File
@@ -238,7 +238,7 @@ mrb_to_time_t(mrb_state *mrb, mrb_value obj, time_t *usec)
mrb_float f = mrb_float(obj);
mrb_check_num_exact(mrb, f);
if (f > (mrb_float)MRB_TIME_MAX || (mrb_float)MRB_TIME_MIN > f) {
if (f >= ((mrb_float)MRB_TIME_MAX-1.0) || f < ((mrb_float)MRB_TIME_MIN+1.0)) {
goto out_of_range;
}