All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Elia Pinto <gitter.spiros@gmail.com>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jonathan Tan <jonathantanmy@fastmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3 2/5] object-file: use size_t for loose object sizes
Date: Fri, 20 Nov 2026 14:26:56 +0100	[thread overview]
Message-ID: <awBKj7DjFg6i0kVj@pks.im> (raw)
In-Reply-To: <c9facd8b3b8a60c8516075616f66da4308380684.1795069177.git.gitter.spiros@gmail.com>

On Thu, Nov 19, 2026 at 07:21:47AM +0100, Elia Pinto wrote:
> Since c6a4629e32 (odb: use size_t for object_info.sizep and the size
> APIs, 2026-06-15), parse_loose_header() reports the object size as a
> size_t, but unpack_loose_rest() takes it as an "unsigned long". Where
> "long" has 32 bits while size_t has 64, as on 64-bit Windows, a header
> claiming 4GiB + 5 bytes makes us allocate 6 bytes; the check added by
> the previous commit passes, as the stream does hold 5 bytes, and the
> caller then reads the object as 4GiB + 5 bytes long.
> 
> Use size_t along the whole loose object reading path. No st_add() is
> needed on the way: the size is parsed with st_mult() and st_add(), and
> a buffer of that size is allocated with xmallocz() before anything is
> added to it or subtracted from it.
> 
> No test, as the reader allocates the claimed size before it notices
> the short stream. On Windows,
> 
> 	printf short |
> 	loose_obj .git/objects commit $((4 * 1024 * 1024 * 1024 + 5))
> 
> and "git cat-file commit" on the resulting object reproduce it.

This reads weird, as it doesn't give me any information on why this
statement means we cannot have a test. Did you just ask AI to "please
shorten the messages"?

AI is very bad in writing good commit messages, as it tends to ramble
without conveying what actually matters, and because it has a very
uncanny feeling to it. A reader _will_ notice that, there's a certain
vibe to it that is very hard to miss. I've been saying this elsewhere
already, but because of this, commit messages are now the one signal to
me whether somebody is investing their own time into a patch series. If
it reads off in that certain way, then my assumption is that the author
either didn't bother reading the generated output, or polishing it. And
that significantly reduces my willingness to spend my own time on
reviewing a patch series, as it is likely that I will have to invest
more time reviewing it than the author did thinking about what they are
doing.

So in the end, everyone loses :/

Patrick

  reply	other threads:[~2026-11-20 13:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 10:28 [PATCH 0/6] loose object size checks and a few size truncations Elia Pinto
2026-10-30 10:28 ` [PATCH 1/6] object-file: check size of inflated loose object against its header Elia Pinto
2026-10-30 10:28 ` [PATCH 2/6] object-file: use size_t for loose object sizes Elia Pinto
2026-10-30 10:28 ` [PATCH 3/6] odb/source-loose: check object size when streaming loose objects Elia Pinto
2026-10-30 10:28 ` [PATCH 4/6] cat-file: use size_t for the length passed to batch_write() Elia Pinto
2026-10-30 10:28 ` [PATCH 5/6] notes: avoid truncating the size of concatenated notes Elia Pinto
2026-10-30 10:28 ` [PATCH 6/6] diff: use size_t in count_trailing_blank() Elia Pinto
2026-11-17 11:38 ` [PATCH v2 0/5] loose object size checks and a few size truncations Elia Pinto
2026-11-17 11:38   ` [PATCH v2 1/5] object-file: check size of inflated loose object against its header Elia Pinto
2026-11-17 19:33     ` Junio C Hamano
2026-11-18 12:21     ` Patrick Steinhardt
2026-11-18 18:17       ` Junio C Hamano
2026-11-17 11:38   ` [PATCH v2 2/5] object-file: use size_t for loose object sizes Elia Pinto
2026-11-17 22:34     ` Junio C Hamano
2026-11-17 11:38   ` [PATCH v2 3/5] odb/source-loose: check object size when streaming loose objects Elia Pinto
2026-11-17 22:55     ` Junio C Hamano
2026-11-17 11:38   ` [PATCH v2 4/5] cat-file: use size_t for the length passed to batch_write() Elia Pinto
2026-11-17 22:59     ` Junio C Hamano
2026-11-17 11:38   ` [PATCH v2 5/5] notes: avoid truncating the size of concatenated notes Elia Pinto
2026-11-17 23:01     ` Junio C Hamano
2026-11-19  6:21   ` [PATCH v3 0/5] loose object size checks and a few size truncations Elia Pinto
2026-11-19  6:21     ` [PATCH v3 1/5] object-file: check size of inflated loose object against its header Elia Pinto
2026-11-19  6:21     ` [PATCH v3 2/5] object-file: use size_t for loose object sizes Elia Pinto
2026-11-20 13:26       ` Patrick Steinhardt [this message]
2026-11-19  6:21     ` [PATCH v3 3/5] odb/source-loose: check object size when streaming loose objects Elia Pinto
2026-11-19  6:21     ` [PATCH v3 4/5] cat-file: use size_t for the length passed to batch_write() Elia Pinto
2026-11-19  6:21     ` [PATCH v3 5/5] notes: avoid truncating the size of concatenated notes Elia Pinto

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=awBKj7DjFg6i0kVj@pks.im \
    --to=ps@pks.im \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gitter.spiros@gmail.com \
    --cc=jonathantanmy@fastmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.