git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-diff-tree crashes on ubuntu kernel git repository
@ 2006-05-22 23:09 Torgil Svensson
       [not found] ` <20060522203634.2f7b0613.seanlkml@sympatico.ca>
  0 siblings, 1 reply; 5+ messages in thread
From: Torgil Svensson @ 2006-05-22 23:09 UTC (permalink / raw)
  To: git

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

As can be seen below there is some obvious error in the output just
prior to the crash:
 drivers/w1/{masters => }/ds_w1_bridge.c            |   38

This file is moved into "w1/masters" by commit
bd529cfb40c427d5b5aae0d315afb9f0a1da5e76

$ git --version
git version 1.3.3.g5e36

$ cat .git/remotes/origin
URL: git://git.kernel.org/pub/scm/linux/kernel/git/bcollins/ubuntu-2.6
Pull: refs/heads/master:refs/heads/origin

 $ gdb git-diff-tree
(gdb) run -p --stat --summary -M
348f179e3195448cea49c98a79cce8c7f446ce26
343ca16424ba031b37e4df49afddaee098a8f347

<...lots of files...>

 drivers/video/w100fb.c                             |  162
 drivers/video/w100fb.h                             |  748 -
 drivers/w1/Kconfig                                 |   62
 drivers/w1/Makefile                                |   10
 drivers/w1/{masters => }/ds_w1_bridge.c            |   38
*** glibc detected *** free(): invalid pointer: 0x12ecbbf0 ***

Program received signal SIGABRT, Aborted.
0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7d7e9a1 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7d802b9 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0xb7db287a in __fsetlocking () from /lib/tls/i686/cmov/libc.so.6
#4  0xb7db8fd4 in malloc_usable_size () from /lib/tls/i686/cmov/libc.so.6
#5  0xb7db934a in free () from /lib/tls/i686/cmov/libc.so.6
#6  0x08056902 in show_stats (data=0x8deff80) at diff.c:392
#7  0x08058466 in diff_flush (options=0x80686b0) at diff.c:1999
#8  0x0805b143 in log_tree_diff_flush (opt=0x8068680) at log-tree.c:82
#9  0x08049d11 in main (argc=0, argv=0xbfcf8a14) at diff-tree.c:130
(gdb)

As shown above I can easily recreate the crash if you want more info.
Thank you for a wonderful tool.

//Torgil

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Avoid segfault in diff --stat rename output.
       [not found] ` <20060522203634.2f7b0613.seanlkml@sympatico.ca>
@ 2006-05-23  0:36   ` Sean
  2006-05-23  1:02     ` Junio C Hamano
  2006-05-23 19:06     ` [PATCH] Avoid segfault in diff --stat rename output Torgil Svensson
  0 siblings, 2 replies; 5+ messages in thread
From: Sean @ 2006-05-23  0:36 UTC (permalink / raw)
  To: Torgil Svensson; +Cc: git


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:

> 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Avoid segfault in diff --stat rename output.
  2006-05-23  0:36   ` [PATCH] Avoid segfault in diff --stat rename output Sean
@ 2006-05-23  1:02     ` Junio C Hamano
  2006-05-23 11:28       ` Q: xasprintf Dmitry V. Levin
  2006-05-23 19:06     ` [PATCH] Avoid segfault in diff --stat rename output Torgil Svensson
  1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2006-05-23  1:02 UTC (permalink / raw)
  To: Sean; +Cc: git

Sean <seanlkml@sympatico.ca> writes:

> Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
> ---
>  diff.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> 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",

Obviously correct given what the sprintf() that immediately
follows does.  Sheesh, what was I smoking back then.  *BLUSH*

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Q: xasprintf
  2006-05-23  1:02     ` Junio C Hamano
@ 2006-05-23 11:28       ` Dmitry V. Levin
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry V. Levin @ 2006-05-23 11:28 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Hi,

On Mon, May 22, 2006 at 06:02:39PM -0700, Junio C Hamano wrote:
> Sean <seanlkml@sympatico.ca> writes:
[...]
> > -		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",
> 
> Obviously correct given what the sprintf() that immediately
> follows does.  Sheesh, what was I smoking back then.  *BLUSH*

What about introducing xasprintf() to eliminate such issues?


-- 
ldv

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Avoid segfault in diff --stat rename output.
  2006-05-23  0:36   ` [PATCH] Avoid segfault in diff --stat rename output Sean
  2006-05-23  1:02     ` Junio C Hamano
@ 2006-05-23 19:06     ` Torgil Svensson
  1 sibling, 0 replies; 5+ messages in thread
From: Torgil Svensson @ 2006-05-23 19:06 UTC (permalink / raw)
  To: git

This patch fixed the issue for me.

On 5/23/06, Sean <seanlkml@sympatico.ca> wrote:
>
> 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:
>
> > 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
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-05-23 19:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-22 23:09 git-diff-tree crashes on ubuntu kernel git repository Torgil Svensson
     [not found] ` <20060522203634.2f7b0613.seanlkml@sympatico.ca>
2006-05-23  0:36   ` [PATCH] Avoid segfault in diff --stat rename output Sean
2006-05-23  1:02     ` Junio C Hamano
2006-05-23 11:28       ` Q: xasprintf Dmitry V. Levin
2006-05-23 19:06     ` [PATCH] Avoid segfault in diff --stat rename output Torgil Svensson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).