mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
time_t may overflow mrb_int when word boxing is used
This commit is contained in:
@@ -671,7 +671,7 @@ 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);
|
||||
#ifdef MRB_INT16
|
||||
#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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user