From: Johannes Schindelin via GitGitGadget Date: Sun, 21 Sep 2025 12:22:33 GMT Subject: [PATCH 0/3] Fix curl_easy_setopt() parameter type problem, again Message-ID: 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