Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15
DORMANTno replies

[PATCH] git-diff: fix combined diff

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:56
Subsystem: the rest · Maintainer: Linus Torvalds

With "const unsigned (*parent)[20]", "parent + 1" is not the
same as "&parent[1]"...

Signed-off-by: Johannes Schindelin <redacted>
---

	I triggered this bug by "git diff a...b", where a and b
	have 4 merge bases. I am really too tired to add a test
	case, though...

 builtin-diff.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-diff.c b/builtin-diff.c
index 9334589..846cafb 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -158,7 +158,8 @@ static int builtin_diff_combined(struct rev_info *revs,
 	parent = xmalloc(ents * sizeof(*parent));
 	/* Again, the revs are all reverse */
 	for (i = 0; i < ents; i++)
-		hashcpy((unsigned char*)parent + i, ent[ents - 1 - i].item->sha1);
+		hashcpy((unsigned char*)&parent[i],
+				ent[ents - 1 - i].item->sha1);
 	diff_tree_combined(parent[0], parent + 1, ents - 1,
 			   revs->dense_combined_merges, revs);
 	return 0;
-- 
1.5.0.1.2218.g2de79
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help