From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH v2 0/3] Fix curl_easy_setopt() parameter type problem, again
Date: Fri, 26 Sep 2025 10:32:49 +0000 [thread overview]
Message-ID: <pull.1974.v2.git.1758882772.gitgitgadget@gmail.com> (raw)
In-Reply-To: <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.
Changes since v1:
* The commit messages now reflect Junio's suggested edits.
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-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1974/dscho/curl-easy-setopt-typefix-again-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1974
Range-diff vs v1:
1: 7caaec9102 ! 1: 114eb9c8ec http: offer to cast `size_t` to `curl_off_t` safely
@@ Commit message
naming convention of the helper functions that safely cast from one data
type to another which has been well established in `git-compat-util.h`.
- With this move, the error message can unfortunately no longer be renamed
- because the `_(...)` function is not available at the time of
- definition.
+ With this move, `gettext.h` must be `#include`d in `http.h` to allow the
+ error message to remain translatable.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2: e1d5a85f70 ! 2: fdd1327e7b imap-send: be more careful when casting to `curl_off_t`
@@ Commit message
imap-send: be more careful when casting to `curl_off_t`
When casting a `size_t` to `curl_off_t`, there is a currently uncommon
- chance that the value can be cut off (`curl_off_t` is supposed to be
- guaranteed to be 64-bit).
+ chance that the value can be cut off (`curl_off_t` is expected to be a
+ signed 64-bit data type).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3: bcb231125c = 3: 140755673d http-push: avoid new compile error
--
gitgitgadget
next prev parent reply other threads:[~2025-09-26 10:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Johannes Schindelin via GitGitGadget [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.1974.v2.git.1758882772.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).