Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin J. Thompson
Tor
Commits
77459b97
Commit
77459b97
authored
8 years ago
by
Ivan Markin
Committed by
Nick Mathewson
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix integer overflow in the rate-limiter (#19435).
parent
264fb7eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changes/bug19435
+6
-0
6 additions, 0 deletions
changes/bug19435
src/common/util.c
+12
-2
12 additions, 2 deletions
src/common/util.c
src/common/util.h
+1
-0
1 addition, 0 deletions
src/common/util.h
with
19 additions
and
2 deletions
changes/bug19435
0 → 100644
+
6
−
0
View file @
77459b97
o Major bugfixes (user interface):
- Fix an integer overflow in the rate-limiter that caused displaying of
wrong number of suppressed messages (if there are too many of them).
If the number of messages hits the limit of messages per interval the
rate-limiter drops a warning and doesn't count any further.
Fixes bug 19435.
This diff is collapsed.
Click to expand it.
src/common/util.c
+
12
−
2
View file @
77459b97
...
...
@@ -1983,7 +1983,9 @@ update_approx_time(time_t now)
/** If the rate-limiter <b>lim</b> is ready at <b>now</b>, return the number
* of calls to rate_limit_is_ready (including this one!) since the last time
* rate_limit_is_ready returned nonzero. Otherwise return 0. */
* rate_limit_is_ready returned nonzero. Otherwise return 0.
* If the call number hits <b>RATELIM_TOOMANY</b> limit, drop a warning
* about this event and stop counting. */
static
int
rate_limit_is_ready
(
ratelim_t
*
lim
,
time_t
now
)
{
...
...
@@ -1993,7 +1995,15 @@ rate_limit_is_ready(ratelim_t *lim, time_t now)
lim
->
n_calls_since_last_time
=
0
;
return
res
;
}
else
{
++
lim
->
n_calls_since_last_time
;
if
(
lim
->
n_calls_since_last_time
<
RATELIM_TOOMANY
)
{
++
lim
->
n_calls_since_last_time
;
}
else
if
(
lim
->
n_calls_since_last_time
==
RATELIM_TOOMANY
)
{
log_warn
(
LD_GENERAL
,
"Enormously large number of messages (%d). It's probably a bug."
,
RATELIM_TOOMANY
);
++
lim
->
n_calls_since_last_time
;
}
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/common/util.h
+
1
−
0
View file @
77459b97
...
...
@@ -292,6 +292,7 @@ typedef struct ratelim_t {
}
ratelim_t
;
#define RATELIM_INIT(r) { (r), 0, 0 }
#define RATELIM_TOOMANY (16*1000)
char
*
rate_limit_log
(
ratelim_t
*
lim
,
time_t
now
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment