diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-12-07 11:14:46 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-12-07 11:14:46 -0500 |
commit | c8bcbf5ac2d61d1befdf2333bffe9d6a09a800ea (patch) | |
tree | 76df5771c019715efeecd4e43dcd38fbf71f1bff | |
parent | 78cb55e42fd5188733f714f8db518ecc02f7f380 (diff) | |
parent | 0815f96416676ace7cfdb5c29000d8cd6ee3459f (diff) | |
download | tor-c8bcbf5ac2d61d1befdf2333bffe9d6a09a800ea.tar.gz tor-c8bcbf5ac2d61d1befdf2333bffe9d6a09a800ea.zip |
Merge branch 'maint-0.2.9' into release-0.2.9
-rw-r--r-- | changes/bug20875 | 4 | ||||
-rw-r--r-- | src/or/directory.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/changes/bug20875 b/changes/bug20875 new file mode 100644 index 0000000000..6bba2cbc12 --- /dev/null +++ b/changes/bug20875 @@ -0,0 +1,4 @@ + o Minor bugfixes (download scheduling) + - Resolve a "bug" warning when considering a download schedule whose + delay had approached INT_MAX. Fixes 20875; bugfix on 0.2.9.5-alpha. + diff --git a/src/or/directory.c b/src/or/directory.c index f4fd521929..fce48c6e95 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -3787,10 +3787,12 @@ STATIC int next_random_exponential_delay(int delay, int max_delay) { /* Check preconditions */ + if (BUG(max_delay < 0)) + max_delay = 0; if (BUG(delay > max_delay)) delay = max_delay; - if (BUG(delay == INT_MAX)) - delay -= 1; /* prevent overflow */ + if (delay == INT_MAX) + return INT_MAX; /* prevent overflow */ if (BUG(delay < 0)) delay = 0; |