Re: [PATCH] ref-iterator-seek: correctly initialize the prefix_state for a new level
- From
Jeff King <peff@peff.net>
- Date
- Jul 23, 2025, 23:52 UTC
- Message-ID
- <20250723235234.GA592873@coredump.intra.peff.net>
- In-Reply-To
- <xmqqldoelgnd.fsf_-_@gitster.g>
On Wed, Jul 23, 2025 at 02:51:50PM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> When cache_ref_iterator_seek() "jumps" to a middle of the sorted ref > list, it forgets to set the .prefix_state member of the new > (i.e. deeper) level it just initialized. This later causes > cache_ref_iterator_advance() to look at this uninitialized member > to base its decision on what to do next. > > Kyle Lippincott [*] and Jeff King noticed this with MSAN and > Valgrind, and Karthik Nayak as the original author located exactly > where the missing initialization is.
This explanation makes sense to me (from my admittedly rusty view of the ref iteration code). And certainly the patch looks right.
-Peff