From: Kristofer Karlsson via GitGitGadget Date: Fri, 06 Nov 2026 12:51:15 GMT Subject: [PATCH 1/2] unpack-objects: pass the size of a streamed blob as size_t Message-ID: <789bb9bca7f4a1c97cfd7a1062d80698cd3e11fc.1793969476.git.gitgitgadget@gmail.com> In-Reply-To: From: Kristofer Karlsson Since f2063855fb (index-pack, unpack-objects: use size_t for object size, 2026-05-08), unpack_one() decodes the size of an object into a size_t. But stream_blob(), which is used for blobs larger than core.bigFileThreshold, still takes that size as "unsigned long". Where that type is only 32 bits wide, such as on Windows, the size of a blob larger than 4GB is truncated, and writing the object fails: fatal: write stream object 4294967304 != 8 This was found by the next commit, which makes t5608 actually exercise the unpack-objects path for a >4GB blob. Take the size as size_t instead. The struct odb_stream it is stored in already uses size_t, as does the rest of the path that writes the loose object. Signed-off-by: Kristofer Karlsson --- builtin/unpack-objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index 351948724a..d2f25bed49 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -386,7 +386,7 @@ static ssize_t zlib_stream_read(struct odb_stream *in_stream, return buf_len - zstream->avail_out; } -static void stream_blob(unsigned long size, unsigned nr) +static void stream_blob(size_t size, unsigned nr) { git_zstream zstream = { 0 }; struct zlib_stream in_stream = { -- gitgitgadget