git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/3] Fix curl_easy_setopt() parameter type problem, again

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Sep 21, 2025, 12:22 UTC
Message-ID
<pull.1974.git.1758457356.gitgitgadget@gmail.com>

As of last week, every CI build of Git for Windows' ARM64 flavor of its SDK started failing (the first failed build is this here: https://github.com/git-for-windows/git-sdk-arm64/actions/runs/17633130672/job/50104373185).

The reason is that we still have one curl_easy_setopt() call that is supposed to pass a long parameter but doesn't.

The likely explanation is an update to libcurl in the Git for Windows/ARM64 SDK. A strange thing about this: GCC does not catch the problem, but clang does. And even more strangely, the relevant parts of cURL's typecheck-gcc.h haven't changed in a way that explains to me why this starts to trigger now.

To prevent more piecemeal solutions, I vetted all calls of curl_easy_setopt() and satisified myself that all remaining calls that want long parameters do indeed have arguments matching that type.

As is the custom in the Git project, I use this opportunity to do a bit more than is strictly necessary to address this problem. I replace the affected call with one that expects a wider data type, refactor an already-existing function to cast to said data type, and use it in the modified call as well as in another call which wants to perform the same cast but did so unsafely (not that it mattered in practice, really, yet it is in line with other refactors the Git project has seen).

Note for the curious: The affected call used CURLOPT_INFILESIZE [https://curl.se/libcurl/c/CURLOPT_INFILESIZE.html] and now uses CURLOPT_INFILESIZE_LARGE [https://curl.se/libcurl/c/CURLOPT_INFILESIZE_LARGE.html], and it is a bit strange that the latter wasn't used in the first place, given that it was introduced into cURL over a year before Git itself was born, and almost two years before the call was introduced in 58e60dd2033 (Add support for pushing to a remote repository using HTTP/DAV, 2005-11-02).

For the record, these patches apply cleanly all the way back to v2.22, according to git replay. I did not try to test whether it builds, though, because all kinds of stunts are required nowadays to build this old versions even without any patches on top.

Johannes Schindelin (3):
  http: offer to cast `size_t` to `curl_off_t` safely
  imap-send: be more careful when casting to `curl_off_t`
  http-push: avoid new compile error
 http-push.c   |  3 ++-
 http.h        | 10 ++++++++++
 imap-send.c   |  2 +-
 remote-curl.c | 14 +++-----------
 4 files changed, 16 insertions(+), 13 deletions(-)
base-commit: ca2559c1d630eb4f04cdee2328aaf1c768907a9e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1974%2Fdscho%2Fcurl-easy-setopt-typefix-again-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1974/dscho/curl-easy-setopt-typefix-again-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1974
-- 
gitgitgadget
Next: Johannes Schindelin via GitGitGadget
Message 1 of 12 in “Fix curl_easy_setopt() parameter type problem, again”
  1. 0/3 Fix curl_easy_setopt() parameter type problem, againJohannes Schindelin via GitGitGadget, Sep 21, 2025
  2. 1/3 http: offer to cast `size_t` to `curl_off_t` safelyJohannes Schindelin via GitGitGadget, Sep 21, 2025
  3. Junio C HamanoSep 21, 2025
  4. 2/3 imap-send: be more careful when casting to `curl_off_t`Johannes Schindelin via GitGitGadget, Sep 21, 2025
  5. Junio C HamanoSep 21, 2025
  6. 3/3 http-push: avoid new compile errorJohannes Schindelin via GitGitGadget, Sep 21, 2025
  7. Junio C HamanoSep 21, 2025
  8. 0/3 Fix curl_easy_setopt() parameter type problem, againJohannes Schindelin via GitGitGadget, Sep 26, 2025
  9. 1/3 http: offer to cast `size_t` to `curl_off_t` safelyJohannes Schindelin via GitGitGadget, Sep 26, 2025
  10. 2/3 imap-send: be more careful when casting to `curl_off_t`Johannes Schindelin via GitGitGadget, Sep 26, 2025
  11. 3/3 http-push: avoid new compile errorJohannes Schindelin via GitGitGadget, Sep 26, 2025
  12. Junio C HamanoSep 26, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.