-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
illegal instruction in progress_meter #9082
Labels
Comments
Could that be a division by zero that appears like that? The divisions on line 271 and 272 seem a bit too "unprotected"... |
If so, this could be a fix: diff --git a/src/tool_progress.c b/src/tool_progress.c
index da5317b92..46185c0d3 100644
--- a/src/tool_progress.c
+++ b/src/tool_progress.c
@@ -266,10 +266,12 @@ bool progress_meter(struct GlobalConfig *global,
/* since the beginning */
deltams = tvdiff(now, *start);
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;
} |
LGTM |
bagder
added a commit
that referenced
this issue
Jul 1, 2022
Reported-by: Brian Carpenter Fixes #9082
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I did this
compiled curl with clang-12 + undefined behavior sanitizer
I then ran
./curl -K test0000 file:///dev/null
test0000 base64:
LU9adwAAUmNoIDg0
I expected the following
No crash.
But instead this happened
curl/libcurl version
Git commit
a8e02881ec9417706610443bcfee6e1104bb44c6
operating system
Linux 5.4.0-121-generic #137-Ubuntu SMP Wed Jun 15 13:33:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: