Skip to content

Commit

Permalink
Fix segfault in diff-delta.c when FLEX_ARRAY is 1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MadCoder authored and gitster committed Dec 18, 2007
1 parent bd8ff61 commit f9c5a80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion diff-delta.c
Expand Up @@ -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;
Expand Down

0 comments on commit f9c5a80

Please sign in to comment.