From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Taylor Blau <me@ttaylorr.com>,
git@vger.kernel.org, Kyle Lippincott <spectral@google.com>,
Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v2 2/3] pack-bitmap.c: avoid uninitialized `pack_int_id` during reuse
Date: Tue, 11 Jun 2024 10:03:10 -0700 [thread overview]
Message-ID: <xmqqy17bwgxd.fsf@gitster.g> (raw)
In-Reply-To: <20240611091102.GL3248245@coredump.intra.peff.net> (Jeff King's message of "Tue, 11 Jun 2024 05:11:02 -0400")
Jeff King <peff@peff.net> writes:
> On Mon, Jun 10, 2024 at 04:10:53PM -0400, Taylor Blau wrote:
>
>> Avoid the uninitialized read by ensuring that the pack_int_id field is
>> set in the single-pack reuse case by setting it to either the MIDX
>> preferred pack's pack_int_id, or '0', in the case of single-pack
>> bitmaps. In the latter case, we never read the pack_int_id field, so
>> the choice of '0' is arbitrary.
>
> Could we set it to some sentinel value for the single-pack case? If we
> set it to "-1", then the BUG() added in patch 3 would trigger if we did
> accidentally try to feed it to the midx code. Assuming you do not have
> 2^32-1 packs, of course. ;)
Yeah, I had exactly the same reaction.
next prev parent reply other threads:[~2024-06-11 17:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-09 15:27 [PATCH] pack-bitmap.c: avoid uninitialized `pack_int_id` during reuse Taylor Blau
2024-06-10 5:55 ` Patrick Steinhardt
2024-06-10 14:57 ` Taylor Blau
2024-06-11 8:12 ` Patrick Steinhardt
2024-06-10 20:10 ` [PATCH v2 0/3] midx: various brown paper bag fixes Taylor Blau
2024-06-10 20:10 ` [PATCH v2 1/3] midx-write.c: do not read existing MIDX with `packs_to_include` Taylor Blau
2024-06-10 20:10 ` [PATCH v2 2/3] pack-bitmap.c: avoid uninitialized `pack_int_id` during reuse Taylor Blau
2024-06-11 9:11 ` Jeff King
2024-06-11 17:03 ` Junio C Hamano [this message]
2024-06-10 20:10 ` [PATCH v2 3/3] pack-revindex.c: guard against out-of-bounds pack lookups Taylor Blau
2024-06-11 17:28 ` [PATCH v2 0/3] midx: various brown paper bag fixes Taylor Blau
2024-06-11 17:28 ` [PATCH v2 1/3] midx-write.c: do not read existing MIDX with `packs_to_include` Taylor Blau
2024-06-11 17:28 ` [PATCH v2 2/3] pack-bitmap.c: avoid uninitialized `pack_int_id` during reuse Taylor Blau
2024-06-11 17:28 ` [PATCH v2 3/3] pack-revindex.c: guard against out-of-bounds pack lookups Taylor Blau
2024-06-11 17:31 ` [PATCH v2 0/3] midx: various brown paper bag fixes Taylor Blau
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=xmqqy17bwgxd.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
--cc=spectral@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).