Re: [PATCH 3/7] pack-objects(check_pack_inflate()): use size_t instead of unsigned long
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 15, 2026, 09:29 UTC
- Message-ID
- <3caf123b-d1ad-5e49-7a95-027569cf62a4@gmx.de>
- In-Reply-To
- <aibJVSrKPCfDVXw7@pks.im>
Hi Patrick,
On Mon, 15 Jun 2026, Patrick Steinhardt wrote:
Show 24 quoted lines
> On Thu, Jun 04, 2026 at 10:51:08AM +0000, Johannes Schindelin via GitGitGadget wrote: > > From: Johannes Schindelin <johannes.schindelin@gmx.de> > > > > `write_reuse_object()` learned to track its packed-object size as > > `size_t` in 606c192380 (odb, packfile: use size_t for streaming > > object sizes, 2026-05-08), but the comparison sink it feeds, > > `check_pack_inflate()`, still takes the expected decompressed size > > as `unsigned long`. The call site bridges the mismatch with > > `cast_size_t_to_ulong()`, which on Windows turns a >4 GiB object > > into an immediate die(). > > > > That function only uses `expect` once: as the right-hand side of a > > `stream.total_out == expect` equality test against zlib's counter. > > zlib's own `total_out` counter is `uLong` and is therefore still > > 32-bit-bound on Windows. Widening `expect` to `size_t` cannot fix that, > > but it is a strict improvement nonetheless: instead of dying outright, > > an oversized object now simply makes the equality fail and lets > > `write_reuse_object()` fall back to `write_no_reuse_object()`, which > > decompresses and re-deflates the content (and which the larger > > pack-objects widening series targets separately). > > Hm. I wonder whether it's possible to reset `stream.total_out` on every > iteration and instead have a local `size_t` variable that we use to > track the total number of inflated bytes?
Possible? Yes. Appropriate? Unlikely. We would now pretend to have inflated less bytes, _just_ to appease a data type limitation that we already worked around in d05d666977 (git-zlib: handle data streams larger than 4GB, 2026-05-08).
Ciao, Johannes