From: Pierre Habouzit Date: Tue, 18 Dec 2007 01:39:57 +0000 (+0100) Subject: Fix segfault in diff-delta.c when FLEX_ARRAY is 1 X-Git-Tag: v1.5.4-rc1~19 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f9c5a80cdf2265f2df7712fad9f1fb7ef68b4768;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/diff-delta.c b/diff-delta.c index 9e440a929..601b49e37 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -264,7 +264,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) index->src_size = bufsize; index->hash_mask = hmask; - mem = index + 1; + mem = index->hash; packed_hash = mem; mem = packed_hash + (hsize+1); packed_entry = mem;