]> git.ipfire.org Git - thirdparty/git.git/commit
git-zlib: handle data streams larger than 4GB
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 8 May 2026 08:16:40 +0000 (08:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 9 May 2026 02:25:31 +0000 (11:25 +0900)
commitd05d6669778fa7dbd72f37c3ad9e4024ca8693d1
tree1814d1346bdd2740055db9125386801ddd1cb2da
parentf2063855fb50217f3720e868d799ed6cb3d0369f
git-zlib: handle data streams larger than 4GB

On Windows, zlib's `uLong` type is 32-bit even on 64-bit systems. When
processing data streams larger than 4GB, the `total_in` and `total_out`
fields in zlib's `z_stream` structure wrap around, which caused the
sanity checks in `zlib_post_call()` to trigger `BUG()` assertions.

The git_zstream wrapper now tracks its own 64-bit totals rather than
copying them from zlib. The sanity checks compare only the low bits,
using `maximum_unsigned_value_of_type(uLong)` to mask appropriately for
the platform's `uLong` size.

This is based on work by LordKiRon in git-for-windows#6076.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-zlib.c
git-zlib.h
object-file.c