diff options
author | Simon Tatham <simon.tatham@arm.com> | 2024-08-07 04:51:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-06 20:51:25 -0700 |
commit | 81d8273978ace8b9a2b8cfd811b94e95f9560ac5 (patch) | |
tree | e8681eede82627f67bb8b27e6ff02c0335ff788f /llvm/lib/CodeGen/MachineRegisterInfo.cpp | |
parent | ee870e593a82a6478ff1d8b3f1bd8a45aa1bf650 (diff) | |
download | llvm-81d8273978ace8b9a2b8cfd811b94e95f9560ac5.zip llvm-81d8273978ace8b9a2b8cfd811b94e95f9560ac5.tar.gz llvm-81d8273978ace8b9a2b8cfd811b94e95f9560ac5.tar.bz2 |
[libc] Fix overflow check for 32-bit mktime. (#101993)
The 32-bit time_t rolls over to a value with its high bit set at
2038-01-19 03:14:07. The overflow check for this in mktime() was
checking each individual component of the time: reject if year>2038, or
if month>1, or if day>19, etc. As a result it would reject valid times
before the overflow point, because a low-order component was out of
range even though a higher-order one makes the time as a whole safe. The
earliest failing value is 2145916808 == 2038-01-01 00:00:08, in which
only the seconds field 'overflows'.
Fixed so that if any component is _less_ than its threshold value, we
don't check the lower-order components.
Diffstat (limited to 'llvm/lib/CodeGen/MachineRegisterInfo.cpp')
0 files changed, 0 insertions, 0 deletions