From: Junio C Hamano Date: Tue, 19 Mar 2013 17:13:10 GMT Subject: Re: [PATCH v2] index-pack: always zero-initialize object_entry list Message-ID: <7vboafjot5.fsf@alter.siamese.dyndns.org> In-Reply-To: <87ehfb2w4q.fsf@pctrast.inf.ethz.ch> Thomas Rast writes: > It apparently relates to the use of .idx.offset to compute the "next" > offset, cf. append_obj_to_pack(): > > struct object_entry *obj = &objects[nr_objects++]; > ... > obj[1].idx.offset = obj[0].idx.offset + n; > obj[1].idx.offset += write_compressed(f, buf, size); > > So you trashed the offset of the first object after all the objects that > are actually *in* the patch. > > And with that: ACK. Ahh, I also was scratching my head about that +1 thing. After all, the +1 in the argument to xrealloc() was already a clue. Thanks both for digging to the bottom of this one.