libstdc++: Fix overflow checks to use the correct "time_t" [PR 93456]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 19 Nov 2020 13:33:11 +0000 (13:33 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 19 Nov 2020 13:33:11 +0000 (13:33 +0000)
commitb108faa9400e13a3d00dd7f71cff0ac45e29c5c9
tree46b5434fd6d1c44308337d97d5cb23e66124f416
parentbf425849f1dfa11f509e9ec251056d1e769b1ac2
libstdc++: Fix overflow checks to use the correct "time_t" [PR 93456]

I recently added overflow checks to src/c++11/futex.cc for PR 93456, but
then changed the type of the timespec for PR 93421. This meant the
overflow checks were no longer using the right range, because the
variable being written to might be smaller than time_t.

This introduces new typedef that corresponds to the tv_sec member of the
struct being passed to the syscall, and uses that typedef in the range
checks.

libstdc++-v3/ChangeLog:

PR libstdc++/93421
PR libstdc++/93456
* src/c++11/futex.cc (syscall_time_t): New typedef for
the type of the syscall_timespec::tv_sec member.
(relative_timespec, _M_futex_wait_until)
(_M_futex_wait_until_steady): Use syscall_time_t in overflow
checks, not time_t.
libstdc++-v3/src/c++11/futex.cc