Skip to content

Commit

Permalink
Fix integer boundary check before float to time_t casting.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Feb 12, 2020
1 parent 736ea1f commit 0301d8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mrbgems/mruby-time/src/time.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 0301d8a

Please sign in to comment.