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_multi_poll` hangs forever on negative timeout #4763

Closed
hamstergene opened this issue Dec 27, 2019 · 3 comments
Closed

`curl_multi_poll` hangs forever on negative timeout #4763

hamstergene opened this issue Dec 27, 2019 · 3 comments

Comments

@hamstergene
Copy link

@hamstergene hamstergene commented Dec 27, 2019

This program hangs forever

#include <curl/curl.h>

int main(int narg, char**argv) {
    curl_global_init( CURL_GLOBAL_ALL );
    CURLM* mh = curl_multi_init();
    curl_multi_poll( mh, 0, 0, /*timeout_ms*/-1, 0 );
}

I expected the following

The function interface takes signed integer (int) it must be ready to handle negative numbers.

curl/libcurl version

7.68.0-20191218

operating system

macOS 10.14.6

@dfandrich

This comment has been minimized.

Copy link
Collaborator

@dfandrich dfandrich commented Dec 27, 2019

@hamstergene

This comment has been minimized.

Copy link
Author

@hamstergene hamstergene commented Dec 27, 2019

Positive and zero are also undocumented. The is simply no documentation on which values are valid. One has to document something first before claiming that everything else is undocumented.

jay added a commit to jay/curl that referenced this issue Dec 28, 2019
- Add new error CURLM_BAD_FUNCTION_ARGUMENT and return that error when
  curl_multi_wait/poll is passed timeout param < 0.

Prior to this change passing a negative value to curl_multi_wait/poll
such as -1 could cause the function to wait forever.

Reported-by: hamstergene@users.noreply.github.com

Fixes curl#4763

Closes #xxxx
@jay

This comment has been minimized.

Copy link
Member

@jay jay commented Dec 28, 2019

It's implied though we should error if negative. I couldn't find a good error code for it so I've added one in #4765 and if approved that will address this issue in the release after next.

@jay jay added the libcurl API label Dec 28, 2019
jay added a commit to jay/curl that referenced this issue Dec 28, 2019
- Add new error CURLM_BAD_FUNCTION_ARGUMENT and return that error when
  curl_multi_wait/poll is passed timeout param < 0.

Prior to this change passing a negative value to curl_multi_wait/poll
such as -1 could cause the function to wait forever.

Reported-by: hamstergene@users.noreply.github.com

Fixes curl#4763

Closes #xxxx
jay added a commit to jay/curl that referenced this issue Dec 28, 2019
- Add new error CURLM_BAD_FUNCTION_ARGUMENT and return that error when
  curl_multi_wait/poll is passed timeout param < 0.

Prior to this change passing a negative value to curl_multi_wait/poll
such as -1 could cause the function to wait forever.

Reported-by: hamstergene@users.noreply.github.com

Fixes curl#4763

Closes #xxxx
@bagder bagder added the documentation label Jan 4, 2020
@jay jay closed this in b700662 Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.