Git development
 help / color / mirror / Atom feed
From: Elia Pinto <gitter.spiros@gmail.com>
To: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 4/4] pack-check: use size_t for the size passed to verify callbacks
Date: Thu, 19 Nov 2026 07:05:23 +0100	[thread overview]
Message-ID: <20261119060524.775205-3-gitter.spiros@gmail.com> (raw)
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

      reply	other threads:[~2026-11-19  6:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31 11:39 [PATCH 0/4] use size_t when receiving and verifying packs Elia Pinto
2026-10-31 11:39 ` [PATCH 1/4] unpack-objects: use size_t for object sizes Elia Pinto
2026-10-31 11:39 ` [PATCH 2/4] index-pack: use size_t in write_compressed() Elia Pinto
2026-10-31 11:39 ` [PATCH 3/4] index-pack: use size_t for object sizes Elia Pinto
2026-10-31 11:39 ` [PATCH 4/4] pack-check: use size_t for the size passed to verify callbacks Elia Pinto
2026-11-18  6:56 ` [PATCH v2 0/4] use size_t when receiving and verifying packs Elia Pinto
2026-11-18  6:56   ` [PATCH v2 1/4] unpack-objects: use size_t for object sizes Elia Pinto
2026-11-18 13:33     ` Patrick Steinhardt
2026-11-18 16:59       ` Junio C Hamano
2026-11-19 10:09         ` Patrick Steinhardt
2026-11-19  6:05       ` Elia Pinto
2026-11-19 10:12         ` Patrick Steinhardt
2026-11-19 17:48           ` Elia Pinto
2026-11-18  6:56   ` [PATCH v2 2/4] index-pack: use size_t in write_compressed() Elia Pinto
2026-11-18 13:33     ` Patrick Steinhardt
2026-11-19  6:05       ` Elia Pinto
2026-11-18  6:56   ` [PATCH v2 3/4] index-pack: use size_t for object sizes Elia Pinto
2026-11-18  6:56   ` [PATCH v2 4/4] pack-check: use size_t for the size passed to verify callbacks Elia Pinto
2026-11-18 13:34     ` Patrick Steinhardt
2026-11-19  6:05       ` Elia Pinto [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119060524.775205-3-gitter.spiros@gmail.com \
    --to=gitter.spiros@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox