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

Curl_pgrsTime - return new time to avoid timeout integer overflow #5847

Closed
wants to merge 1 commit into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Aug 24, 2020

Setting a timeout to INT_MAX could cause an immediate error to get
returned as timeout because of an overflow when different values of
'now' were used.

This is primarily fixed by having Curl_pgrsTime() return the "now" when
TIMER_STARTSINGLE is set so that the parent function will continue using
that time.

Reported-by: Ionuț-Francisc Oancea
Fixes #5583

Setting a timeout to INT_MAX could cause an immediate error to get
returned as timeout because of an overflow when different values of
'now' were used.

This is primarily fixed by having Curl_pgrsTime() return the "now" when
TIMER_STARTSINGLE is set so that the parent function will continue using
that time.

Reported-by: Ionuț-Francisc Oancea
Fixes #5583
@bagder
Copy link
Member Author

bagder commented Aug 24, 2020

@ioancea: I'd appreciate your comments on this!

@bagder bagder closed this in a2c85bb Aug 28, 2020
@bagder bagder deleted the bagder/timeout-overflow branch August 28, 2020 12:17
@ioancea
Copy link

ioancea commented Aug 31, 2020

@bagder Sorry for the missing reply in the original issue - I planned to do a fix but, because the problem was "workaroundable", I postponed it 🤦

The changes look ok to me, I like your idea to overwrite the now variable received as input - it basically solves the problem w/o the need to do extra calls to the time function 👍

Thanks a lot for your support!

@bagder
Copy link
Member Author

bagder commented Aug 31, 2020

Excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants