From: Junio C Hamano Date: Tue, 11 Jun 2024 17:03:10 GMT Subject: Re: [PATCH v2 2/3] pack-bitmap.c: avoid uninitialized `pack_int_id` during reuse Message-ID: In-Reply-To: <20240611091102.GL3248245@coredump.intra.peff.net> Jeff King 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.