git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 4/4] pack-check: use size_t for the size passed to verify callbacks

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 18, 2026, 13:34 UTC
Message-ID
<av2pUyAwTA7e2eOj@pks.im>
In-Reply-To
<00939c7f1b144fb9dbbc1745e60f7baa18217742.1794984184.git.gitter.spiros@gmail.com>
On Wed, Nov 18, 2026 at 07:56:38AM +0100, Elia Pinto wrote:
Show 10 quoted lines
> verify_pack() in pack-check.c passes each object to a verify_fn callback
> (defined in pack.h) taking the object size as an "unsigned long", even
> though pack-check already handles it as a size_t. This signature is also
> replicated in struct odb_fsck_options (odb.h) and implemented by
> fsck_obj_buffer() in builtin/fsck.c.
> 
> On platforms where "long" is 32 bits while size_t is 64, such as
> 64-bit Windows, running "git fsck" on packs with objects of 4GiB or
> more passes a truncated size to fsck_obj_buffer(), causing
> parse_object_buffer() and fsck_object() to inspect only a prefix.

The more interesting question to me is: if they only inspect a prefix, do they actually notice that something is off and report the error? If not that certainly sounds like a bug to me.

Patrick
Previous: Elia Pinto
Message 13 of 13 in “use size_t when receiving and verifying packs”
  1. 0/4 use size_t when receiving and verifying packsElia Pinto, Oct 31, 2026
  2. 1/4 unpack-objects: use size_t for object sizesElia Pinto, Oct 31, 2026
  3. 2/4 index-pack: use size_t in write_compressed()Elia Pinto, Oct 31, 2026
  4. 3/4 index-pack: use size_t for object sizesElia Pinto, Oct 31, 2026
  5. 4/4 pack-check: use size_t for the size passed to verify callbacksElia Pinto, Oct 31, 2026
  6. 0/4 use size_t when receiving and verifying packsElia Pinto, Nov 18, 2026
  7. 1/4 unpack-objects: use size_t for object sizesElia Pinto, Nov 18, 2026
  8. Patrick SteinhardtNov 18, 2026
  9. 2/4 index-pack: use size_t in write_compressed()Elia Pinto, Nov 18, 2026
  10. Patrick SteinhardtNov 18, 2026
  11. 3/4 index-pack: use size_t for object sizesElia Pinto, Nov 18, 2026
  12. 4/4 pack-check: use size_t for the size passed to verify callbacksElia Pinto, Nov 18, 2026
  13. Patrick SteinhardtNov 18, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.