git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix curl_easy_setopt() parameter type problem, again
@ 2025-09-21 12:22 Johannes Schindelin via GitGitGadget
  2025-09-21 12:22 ` [PATCH 1/3] http: offer to cast `size_t` to `curl_off_t` safely Johannes Schindelin via GitGitGadget
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2025-09-21 12:22 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-09-26 17:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-21 12:22 [PATCH 0/3] Fix curl_easy_setopt() parameter type problem, again Johannes Schindelin via GitGitGadget
2025-09-21 12:22 ` [PATCH 1/3] http: offer to cast `size_t` to `curl_off_t` safely Johannes Schindelin via GitGitGadget
2025-09-21 14:52   ` Junio C Hamano
2025-09-21 12:22 ` [PATCH 2/3] imap-send: be more careful when casting to `curl_off_t` Johannes Schindelin via GitGitGadget
2025-09-21 15:06   ` Junio C Hamano
2025-09-21 12:22 ` [PATCH 3/3] http-push: avoid new compile error Johannes Schindelin via GitGitGadget
2025-09-21 15:09   ` Junio C Hamano
2025-09-26 10:32 ` [PATCH v2 0/3] Fix curl_easy_setopt() parameter type problem, again Johannes Schindelin via GitGitGadget
2025-09-26 10:32   ` [PATCH v2 1/3] http: offer to cast `size_t` to `curl_off_t` safely Johannes Schindelin via GitGitGadget
2025-09-26 10:32   ` [PATCH v2 2/3] imap-send: be more careful when casting to `curl_off_t` Johannes Schindelin via GitGitGadget
2025-09-26 10:32   ` [PATCH v2 3/3] http-push: avoid new compile error Johannes Schindelin via GitGitGadget
2025-09-26 17:40   ` [PATCH v2 0/3] Fix curl_easy_setopt() parameter type problem, again Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).