Re: [PATCH 1/6] index-pack, unpack-objects: use size_t for object size
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Apr 30, 2026, 14:13 UTC
- Message-ID
- <20260430141320.GA6659@tb-raspi4>
- In-Reply-To
- <dc660106ea8511e6adc44d2b70e9a4ae8b18090e.1777393580.git.gitgitgadget@gmail.com>
On Tue, Apr 28, 2026 at 04:26:15PM +0000, Johannes Schindelin via GitGitGadget wrote:
Show 16 quoted lines
> 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.