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

Infinite loop in singlesocket #3970

Closed
ericwuseattle opened this issue May 30, 2019 · 1 comment
Closed

Infinite loop in singlesocket #3970

ericwuseattle opened this issue May 30, 2019 · 1 comment
Assignees

Comments

@ericwuseattle
Copy link

ericwuseattle commented May 30, 2019

(gdb) p *entry
$29 = {
list = {
head = 0x80be848,
tail = 0x80be848,
dtor = 0x0,
size = 1
},
action = 1,
socketp = 0x0,
users = 1,
readers = 1,
writers = 0
}

  1. the loop i = 0 to MAX_SOCKSPEREASYHANDLE
    https://github.com/curl/curl/blob/master/lib/multi.c#L2234

  2. i was setting back to 0
    https://github.com/curl/curl/blob/master/lib/multi.c#L2255

  3. when entry action == comboaction will go back 1) and i = 1, 2) will set to 0 again. loop forever.
    // comboaction = 1, entry->action = 1
    https://github.com/curl/curl/blob/master/lib/multi.c#L2306

could we make a change to use index rather re-using i?
For example:
/* check if new for this transfer */
int index = 0;
for(index; index < data->numsocks; index++) {

bagder added a commit that referenced this issue May 31, 2019
An inner loop within the singlesocket() function wrongly re-used the
variable for the outer loop which then could cause an infinite
loop. Change to using a separate variable!

Reported-by: Eric Wu
Fixes #3970
@bagder
Copy link
Member

bagder commented May 31, 2019

Thanks, I agree with your conclusion and I've proposed PR #3973 to fix this!

@bagder bagder self-assigned this May 31, 2019
@bagder bagder closed this as completed in c36f428 Jun 1, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants