From: Nicolas Pitre Date: Tue, 17 Oct 2006 20:25:30 GMT Subject: Re: heads-up: git-index-pack in "next" is broken Message-ID: In-Reply-To: <7vy7reitzm.fsf@assigned-by-dhcp.cox.net> On Tue, 17 Oct 2006, Junio C Hamano wrote: > Sergey Vlasov writes: > > > On Tue, 17 Oct 2006 14:47:16 -0400 (EDT) Nicolas Pitre wrote: > > > >> Is it possible that sizeof(union delta_base) might not be equal to 20 > >> for you? > > > > Yes, on x86_64 this is 24 because of 8-byte alignment for longs: > > Enough eyeballs made this bug shallow ;-) Thanks. > > diff --git a/index-pack.c b/index-pack.c > index fffddd2..49b6efe 100644 > --- a/index-pack.c > +++ b/index-pack.c > @@ -166,6 +166,7 @@ static void *unpack_raw_entry(unsigned l > case OBJ_REF_DELTA: > if (pos + 20 >= pack_limit) > bad_object(offset, "object extends past end of pack"); > + memset(delta_base, 0, sizeof(*delta_base)); > hashcpy(delta_base->sha1, pack_base + pos); Yeah.... but this is a bit wasteful since (especially on 32-bit archs) you just write to the same memory twice in a row. Nicolas