@matheusbsbs / matheus-bagliano / commits / f9c5a80cdf
Fork 0

Fix segfault in diff-delta.c when FLEX_ARRAY is 1

aka don't do pointer arithmetics on structs that have a FLEX_ARRAY member, or you'll end up believing your array is 1 cell off its real address. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pierre Habouzit committed Dec 18, 2007 at 02:39 UTC f9c5a80cdf2265f2df7712fad9f1fb7ef68b4768
1 file changed +1 -1
diff-delta.c
+1 -1
@@ -264,7 +264,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
264 index->src_size = bufsize;
265 index->hash_mask = hmask;
266
267 - mem = index + 1;
267 + mem = index->hash;
268 packed_hash = mem;
269 mem = packed_hash + (hsize+1);
270 packed_entry = mem;