Re: [PATCH 1/6] index-pack, unpack-objects: use size_t for object size
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 3, 2026, 14:46 UTC
- Message-ID
- <1d2034e3-5a1c-81e7-88a6-65558da2360a@gmx.de>
- In-Reply-To
- <20260430141320.GA6659@tb-raspi4>
Hi Torsten,
On Sun, 3 May 2026, Torsten Bögershausen wrote:
Show 23 quoted lines
> On Tue, Apr 28, 2026 at 04:26:15PM +0000, Johannes Schindelin via GitGitGadget wrote: > > From: Johannes Schindelin <johannes.schindelin@gmx.de> > > > > When unpacking objects from a packfile, the object size is decoded > > from a variable-length encoding. On platforms where unsigned long is > > 32-bit (such as Windows, even in 64-bit builds), the shift operation > > overflows when decoding sizes larger than 4GB. The result is a > > truncated size value, causing the unpacked object to be corrupted or > > rejected. > > > > Fix this by changing the size variable to size_t, which is 64-bit on > > 64-bit platforms, and ensuring the shift arithmetic occurs in 64-bit > > space. > > > > This was originally authored by LordKiRon > > <https://github.com/LordKiRon>, who preferred not to reveal their real > > name and therefore agreed that I take over authorship. > > Good to see things moving forward. > > See even > https://github.com/git-for-windows/git/pull/2179 > which is probably obsolete soon.
The word "probably" is maybe a bit overwhelmed in this sentence by the sheer extent of what still needs to be done.
There have been multiple contributors who despaired over the task [*1*] to split this PR apart in ways that would stand a chance to be accepted (or for that matter: reviewed) on the Git mailing list...
But yes, it is my hope that I can wittle down that PR into more contributions along the lines of f9ba6acaa934 (Merge branch 'mc/clean-smudge-with-llp64', 2021-11-29). I still have to upstream https://github.com/git-for-windows/git/pull/3533, which is another teeny tiny step toward completing what the PR you mentioned set out to accomplish.
And yes, the pattern that Stolee already recognized, to duplicate function signatures into the ones that the 20th century kindly asked to be returned and the ones using `size_t` instead, this is the pattern I specifically wanted to use so that incremental patch series have a chance of getting reviews and to trickle into git/git.
Ciao, Johannes
Footnote *1*: I specifically asked for this kind of splitting-out: https://github.com/git-for-windows/git/pull/2179#issuecomment-525926366