google-cloud-cpp: CurlRequest::MakeRequestImpl could crash when SetOption for CURLOPT_BUFFERSIZE

Does this issue affect the google-cloud-cpp project? If the problem is with the Google Cloud service exposed by the google-cloud-cpp libraries instead of the client libraries themselves, you may consider opening a support request instead. The google-cloud-cpp developers cannot help you troubleshoot problems with the service itself. Yes.

What component of google-cloud-cpp is this related to? For example, is this related to bigtable (i.e., something in google/cloud/bigtable), or GCS (i.e., something in google/cloud/storage)? google/cloud/storage

Describe the bug Curl lib setopt.c checks data->state.buffer and return CURLE_BAD_FUNCTION_ARGUMENT(https://github.com/curl/curl/pull/5842/files). CurlRequestBuilder uses handle_ from a PooledCurlHandleFactory that reuses handle. The handle could still have data->state.buffer set and would cause runtime error when CurlRequest::MakeRequestImpl is called to SetOption for CURLOPT_BUFFERSIZE.

To Reproduce Steps to reproduce the behavior:

  1. Call function ‘Curl::Client::CreateResumableSessionGeneric’
  2. See runtime error.

Expected behavior A clear and concise description of what you expected to happen. No runtime error.

Operating system: If you are using a Linux distribution please include the name and version of the distribution too.

What compiler and version are you using? Please include the output of g++ -v or clang++ -v or the equivalent command-line flag.

What version of google-cloud-cpp are you using? Please include the output from git rev-parse HEAD if you are compiling from source, or the version number from the applicable google/cloud/*/version.h file.

Additional context Add any other context about the problem here. In EasyPerform -> easy_perform in easy.c either easy_events or easy_transfer would be called to initiate a transfer and possibly initialize data->state.buffer. In curl_multi_remove_handle, the multi_done step would call Curl_safefree for data->state.buffer. So not sure why data->state.buffer would be set.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

The suggestion on disabling connection cache really helped. Thanks a lot. Since the connection cache is managed internally inside google-cloud-cpp, is it possible to get a final solution with the connection cache enabled?

We certainly want to fix the bug, but at this time I am not sure I know where the bug is. The only idea I have is to upgrade our version of libcurl. We could also ignore this error. The value of CURLOPT_BUFFERSIZE is just an optimization, and a small one at that. I am currently digging myself out of several existing bugs, I cannot provide an ETA just at this moment.