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
Elia Pinto <gitter.spiros@gmail.com>
Date
Nov 19, 2026, 06:05 UTC
Message-ID
<20261119060524.775205-3-gitter.spiros@gmail.com>
In-Reply-To
<av2pUyAwTA7e2eOj@pks.im>
On Wed, Nov 18, 2026 at 02:34:11PM +0100, Patrick Steinhardt wrote:
> 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.

Looking at it again, on master the callback is not even reached for such an object. Just before calling it, verify_packfile() checks the object with check_object_signature(), which also takes an "unsigned long". It hashes only the prefix, the hash does not match, and fsck reports "packed <oid> from <pack> is corrupt" for an object that is fine. So fsck does complain, but for the wrong reason, and the commit message is wrong to say that the callbacks look at a prefix today.

check_object_signature() is changed by 1/4 of "use size_t when parsing and checking objects" [1]. Only then is the callback reached, and it needs this patch to get the whole size, plus the rest of [1] for parse_object_buffer() and fsck_object(). So 4/4 belongs on top of [1], and I will resend it there with a corrected message.

Blobs are not affected: on these platforms core.bigFileThreshold, an "unsigned long" itself, is below 4GiB, so every blob that large is checked with stream_object_signature() and reaches the callback without its data.

[1] https://lore.kernel.org/git/cover.1793444420.git.gitter.spiros@gmail.com/

Thanks, Elia

Previous: Patrick Steinhardt
Message 20 of 20 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. Junio C HamanoNov 18, 2026
  10. Patrick SteinhardtNov 19, 2026
  11. Elia PintoNov 19, 2026
  12. Patrick SteinhardtNov 19, 2026
  13. Elia PintoNov 19, 2026
  14. 2/4 index-pack: use size_t in write_compressed()Elia Pinto, Nov 18, 2026
  15. Patrick SteinhardtNov 18, 2026
  16. Elia PintoNov 19, 2026
  17. 3/4 index-pack: use size_t for object sizesElia Pinto, Nov 18, 2026
  18. 4/4 pack-check: use size_t for the size passed to verify callbacksElia Pinto, Nov 18, 2026
  19. Patrick SteinhardtNov 18, 2026
  20. Elia PintoNov 19, 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.