Skip to content
  • maksim.sisov's avatar
    Fix Integer-overflow in base::Time::FromExploded. · eebbdeca
    maksim.sisov authored
    The old implementation doesn't handle possible overflows,
    when year is too large, for example. It makes a result
    to be larger than 2^63 - 1, which results in overflow.
    
    Fix Posix: use safe_math.h for multiplication and addition. If
    overflow occurs, return possibly maximum platform dependent
    value.
    
    Fix Mac and Win: if safe cast is impossible, return Time(0).
    
    Fix media and components: use day of week as well, as long
    as unused variable results in undefined behavior and overflow
    
    BUG=653445
    
    Review-Url: https://codereview.chromium.org/2405453002
    Cr-Commit-Position: refs/heads/master@{#427064}
    eebbdeca