Browse Source

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>
maint
Pierre Habouzit 17 years ago committed by Junio C Hamano
parent
commit
f9c5a80cdf
  1. 2
      diff-delta.c

2
diff-delta.c

@ -264,7 +264,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) @@ -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;

Loading…
Cancel
Save