Skip to content
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

tool_cb_prg: Fix integer overflow in progress bar #3984

Closed

Conversation

@danielgustafsson
Copy link
Member

commented Jun 4, 2019

Commit 61faa0b fixed the progress bar width calculation to avoid integer overflow, but failed to account for the fact that initial_size is initialized to -1 causing another signed integer overflow. Fix by separately checking for this case before the width calculation.

Closes #xxxx
Reported-by: Brian Carpenter (Geeknik Labs)

tool_cb_prg: Fix integer overflow in progress bar
Commit 61faa0b fixed the progress bar
width calculation to avoid integer overflow, but failed to account for
the fact that initial_size is initialized to -1 causing another signed
integer overflow.  Fix by separately checking for this case before the
width calculation.

Closes #xxxx
Reported-by: Brian Carpenter (Geeknik Labs)
@bagder

bagder approved these changes Jun 8, 2019

Copy link
Member

left a comment

Maybe add a comment on why/how it can be less than zero at this point?

@jay

This comment has been minimized.

Copy link
Member

commented Jun 10, 2019

Maybe add a comment on why/how it can be less than zero at this point?

AFAICT it's only set to -1 to signal resuming an upload and that only works with FTP (and SSH) where libcurl gets the file size of the remote file and then resumes the upload from that position.

curl/src/tool_operate.c

Lines 747 to 748 in 69248b5

if(uploadfile && config->resume_from_current)
config->resume_from = -1; /* -1 will then force get-it-yourself */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.