mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
add similar range check for tm->usec as well
This commit is contained in:
@@ -685,11 +685,9 @@ mrb_time_usec(mrb_state *mrb, mrb_value self)
|
|||||||
struct mrb_time *tm;
|
struct mrb_time *tm;
|
||||||
|
|
||||||
tm = DATA_GET_PTR(mrb, self, &mrb_time_type, struct mrb_time);
|
tm = DATA_GET_PTR(mrb, self, &mrb_time_type, struct mrb_time);
|
||||||
#ifdef MRB_INT16
|
|
||||||
if (tm->usec > MRB_INT_MAX || tm->usec < MRB_INT_MIN) {
|
if (tm->usec > MRB_INT_MAX || tm->usec < MRB_INT_MIN) {
|
||||||
return mrb_float_value(mrb, (mrb_float)tm->usec);
|
return mrb_float_value(mrb, (mrb_float)tm->usec);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return mrb_fixnum_value((mrb_int)tm->usec);
|
return mrb_fixnum_value((mrb_int)tm->usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user