summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-time
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-02-12 11:54:32 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-02-12 11:54:32 +0900
commit0301d8a89bb802b04a5d34a1c2376875338d3655 (patch)
tree44c1cdb1ceed36c60a22883526c17f41096c25fc /mrbgems/mruby-time
parent736ea1f5c71a7e79b6c83b27c96c88ccaba08d2d (diff)
downloadmruby-0301d8a89bb802b04a5d34a1c2376875338d3655.tar.gz
mruby-0301d8a89bb802b04a5d34a1c2376875338d3655.zip
Fix integer boundary check before `float` to `time_t` casting.
Diffstat (limited to 'mrbgems/mruby-time')
-rw-r--r--mrbgems/mruby-time/src/time.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index 7197b634c..5ce43e465 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -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;
}