Re: [RFC PATCH] unpack-trees: watch for out-of-range index position
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 8, 2020, 20:35 UTC
- Message-ID
- <xmqqo8vd1yb2.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20200108193833.GD181522@google.com>
Emily Shaffer <emilyshaffer@google.com> writes:
Show 15 quoted lines
>> > The new condition you added looks correct to me. I suspect this BUG() >> > should not be a BUG() at all, though. It's not necessarily a logic error >> > inside Git, but as you showed it could indicate corrupt data we read >> > from disk. The true is probably same of the "pos >= 0" condition checked >> > above. >> >> It does not sound like a BUG to me, either, but the new condition >> does look correct to me, too. We can turn it into die() later if >> somebody truly cares ;-) >> >> Thanks, both. Will queue. > > Thanks much for the quick turnaround. If I hear more noise I'll give it > a try with die() or error code instead, but for now I'll move on to the > next bug on my list. :)
By the way, it is somewhat sad that we proceeded that far in the first place---such a corrupt on-disk index would have caused an early die() if we did not get rid of the trailing-hash integrity check.