git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Avoid segfault in diff --stat rename output.

From
Sean <seanlkml@sympatico.ca>
Date
May 23, 2006, 00:36 UTC
Message-ID
<BAYC1-PASMTP115C9137E5BDABD705881BAE9B0@CEZ.ICE>
In-Reply-To
<e7bda7770605221609h7c18c2ccpe92db34050d46f9f@mail.gmail.com>
Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
---
 diff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

On Tue, 23 May 2006 01:09:43 +0200 "Torgil Svensson" <torgil.svensson@gmail.com> wrote:

Show 9 quoted lines
> Hi
> 
> It seems like git-diff-tree has some problems with moved files:
> 
> $ git-diff-tree -p --stat --summary -M
> 348f179e3195448cea49c98a79cce8c7f446ce26
> 343ca16424ba031b37e4df49afddaee098a8f347 | wc -l
> *** glibc detected *** free(): invalid pointer: 0x12ecbbf0 ***
> 6101
diff --git a/diff.c b/diff.c
index 7f35e59..a7bb9b9 100644
--- a/diff.c
+++ b/diff.c
@@ -237,7 +237,7 @@ static char *pprint_rename(const char *a
 		if (a_midlen < 0) a_midlen = 0;
 		if (b_midlen < 0) b_midlen = 0;
 
-		name = xmalloc(len_a + len_b - pfx_length - sfx_length + 7);
+		name = xmalloc(pfx_length + a_midlen + b_midlen + sfx_length + 7);
 		sprintf(name, "%.*s{%.*s => %.*s}%s",
 			pfx_length, a,
 			a_midlen, a + pfx_length,
-- 
1.3.GIT
Previous: Torgil SvenssonNext: Junio C Hamano
Message 2 of 5 in “git-diff-tree crashes on ubuntu kernel git repository”
  1. Torgil SvenssonMay 22, 2006
  2. Avoid segfault in diff --stat rename output.Sean, May 23, 2006
  3. Junio C HamanoMay 23, 2006
  4. Q: xasprintfDmitry V. Levin, May 23, 2006
  5. Torgil SvenssonMay 23, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.