mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
857de45036
when converting microseconds to nanoseconds, multiplying very large usec values by 1000 can cause signed integer overflow. for example, Time.at(0, 9999999999990768) would trigger ASAN runtime error. fixed by normalizing microseconds >= 1000000 (or <= -1000000) to seconds before the multiplication, preventing overflow while maintaining correct time representation. this normalization converts excess microseconds to seconds, leaving only the fractional part for multiplication. applied fix to both time_alloc() and mrb_time_at() functions. Co-authored-by: Claude <noreply@anthropic.com>