Skip to content

Commit

Permalink
tool_progress: avoid division by zero in parallel progress meter
Browse files Browse the repository at this point in the history
Reported-by: Brian Carpenter
Fixes #9082
  • Loading branch information
bagder committed Jul 1, 2022
1 parent 4d4c227 commit f274be0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tool_progress.c
Expand Up @@ -268,6 +268,8 @@ bool progress_meter(struct GlobalConfig *global,
dl = all_dlnow;
ul = all_ulnow;
}
if(!deltams) /* no division by zero please */
deltams++;
dls = (curl_off_t)((double)dl / ((double)deltams/1000.0));
uls = (curl_off_t)((double)ul / ((double)deltams/1000.0));
speed = dls > uls ? dls : uls;
Expand Down

0 comments on commit f274be0

Please sign in to comment.