summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-time
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-10-03 14:57:22 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-10-03 14:57:22 +0900
commit95b3a7029158a1fd1e9a316142f853eec58084aa (patch)
treefa305ab3cc9991cc7aaa3e973a741346f538e815 /mrbgems/mruby-time
parent88d14e03d0753cfb123d061f29aaaa8c03aca1e5 (diff)
downloadmruby-95b3a7029158a1fd1e9a316142f853eec58084aa.tar.gz
mruby-95b3a7029158a1fd1e9a316142f853eec58084aa.zip
always check range before casting time_t to mrb_int
Diffstat (limited to 'mrbgems/mruby-time')
-rw-r--r--mrbgems/mruby-time/src/time.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index 5f60eef4d..93cc592a8 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -671,11 +671,9 @@ mrb_time_to_i(mrb_state *mrb, mrb_value self)
struct mrb_time *tm;
tm = DATA_GET_PTR(mrb, self, &mrb_time_type, struct mrb_time);
-#if defined(MRB_INT16) || defined(MRB_WORD_BOXING)
if (tm->sec > MRB_INT_MAX || tm->sec < MRB_INT_MIN) {
return mrb_float_value(mrb, (mrb_float)tm->sec);
}
-#endif
return mrb_fixnum_value((mrb_int)tm->sec);
}