mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 10:12:15 +01:00
Fix get_delay() code to avoid TIME_MAX overflow, not INT_MAX.
Fixes bug 20587; bugfix on 35bbf2e4a4
in 0.2.8.1-alpha.
This commit is contained in:
parent
add164aa41
commit
1b22eae120
6
changes/bug20587
Normal file
6
changes/bug20587
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
o Minor bugfixes (download timing):
|
||||||
|
- When determining when to download a directory object, handle times
|
||||||
|
after 2038 if the operating system supports that. (Someday this will be
|
||||||
|
important!) Fixes bug 20587; bugfix on 0.2.8.1-alpha.
|
||||||
|
|
@ -3876,9 +3876,9 @@ download_status_schedule_get_delay(download_status_t *dls,
|
|||||||
* non-negative allows us to safely do the wrapping check below. */
|
* non-negative allows us to safely do the wrapping check below. */
|
||||||
tor_assert(delay >= 0);
|
tor_assert(delay >= 0);
|
||||||
|
|
||||||
/* Avoid now+delay overflowing INT_MAX, by comparing with a subtraction
|
/* Avoid now+delay overflowing TIME_MAX, by comparing with a subtraction
|
||||||
* that won't overflow (since delay is non-negative). */
|
* that won't overflow (since delay is non-negative). */
|
||||||
if (delay < INT_MAX && now <= INT_MAX - delay) {
|
if (delay < INT_MAX && now <= TIME_MAX - delay) {
|
||||||
dls->next_attempt_at = now+delay;
|
dls->next_attempt_at = now+delay;
|
||||||
} else {
|
} else {
|
||||||
dls->next_attempt_at = TIME_MAX;
|
dls->next_attempt_at = TIME_MAX;
|
||||||
|
Loading…
Reference in New Issue
Block a user