Repository navigation
Conversation
Since the in-memory size limit was raised to 16 GB on 64-bit systems in ad6320b, file2memory() can return more than INT_MAX bytes, but --data-urlencode and the :url variable function pass the size to curl_easy_escape() cast to int. With a file of 4 GB plus 11 bytes, curl silently sent only the first 11 bytes encoded. Between 2 and 4 GB, it said "out of memory". Refuse such data with an error instead.
Contributor
|
This refuses such data with an error instead. I did not add a test since it
needs a file of more than 2 GB.
This isn't entirely impossible to test. It's possible to create a >2 GB sparse
file in the <precheck> section that's gated on the filesystem supporting sparse
file creation. It might be tricky to get the preconditions right to never
block the test and fill the hard drive with an *actual* 2 GB file on any
system, so it might not be worth doing. But, if there are tests on other
options that would benefit from really large files, it might be worth adding
sparse file creation to the test harness.
|
Contributor
Author
|
Thanks. Besides the sparse file, curl reads the data into memory (file2memory), so a test would also need more than 2 GB of RAM in every CI job that runs it. That seemed too heavy for a one-line cast fix, so I left it without a test, but I can add one if you think it's worth it. |
Contributor
|
I assumed it checked the file size and aborted if it was too large, but if it reads it in first then it's not worth doing.
|
bagder
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since ad6320b (8.10.0) curl can load up to 16 GB of a file into memory on 64-bit systems, but
--data-urlencodeand the:urlvariable function still pass the size tocurl_easy_escape()cast to int.With a file of 4 GB plus 11 bytes, curl silently sends only the first 11 bytes, encoded, and exits 0:
the server gets 33 bytes (
%00x 11). Withname@bigit getsname=plus the same 33 bytes, and--variable v@big --expand-data '{{v:url}}'does the same. Between 2 and 4 GB, curl says "out of memory".This refuses such data with an error instead. I did not add a test since it needs a file of more than 2 GB.