pr-2153/dscho/fix-ulong-clamping-for-zlib-v1
tagged this
18 Jun 13:50
From: Johannes Schindelin <johannes.schindelin@gmx.de> On platforms where `unsigned long` and `size_t` differ in bit size, we want to clamp the buffers we pass to zlib to the former's size, as per d05d666977 (git-zlib: handle data streams larger than 4GB, 2026-05-08). The logic introduced in that commit performs a clamping to the bits, though, which fails to do what is needed here: If too many bytes are available in the buffers, we need to clamp to the maximum value of an `unsigned long`. Otherwise, we ask zlib to use too small buffers, in the worst case using 0 as the size (think: a value whose 32 lowest bits are all zero). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Submitted-As: https://lore.kernel.org/git/pull.2153.git.1781790619424.gitgitgadget@gmail.com