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

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)

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)
Copy link
Member

@bagder bagder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@jay
Copy link
Member

jay 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 */

@lock lock bot locked as resolved and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants