bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segmentation fault in C++ demangle


From: DJ Delorie
Subject: Re: Segmentation fault in C++ demangle
Date: Thu, 10 Jan 2002 13:24:50 -0500

Assuming that NULL entries in to->btypevec are allowable, Ok.  I don't
know as much about the demangler code as the other bits; usually the
primary authors take care of their patches.

>   A recent posting pointed to a bug in libiberty:
> 
> http://sources.redhat.com/ml/bug-gnu-utils/2002-01/msg00136.html
> 
>   This appears to be a simple coding oversight; not allowing for the
>   fact that some of the strings in from->btypevec[] can be NULL.  The
>   following patch corrects this and allows the test string supplied
>   with the bug report to pass through cxxfilt with causing a seg
>   fault.
> 
>   OK to apply ?
> 
> Cheers
>         Nick
> 
> 
> 2002-01-10  Nick Clifton  <address@hidden>
> 
>       * cplus-dem.c (work_stuff_copy_to_from): Cope with NULL
>         entries in from->btypevec[].
> 
> Index: libiberty/cplus-dem.c
> ===================================================================
> RCS file: /cvs/src/src/libiberty/cplus-dem.c,v
> retrieving revision 1.27
> diff -p -c -r1.27 cplus-dem.c
> *** cplus-dem.c       2002/01/03 00:25:57     1.27
> --- cplus-dem.c       2002/01/10 14:42:06
> *************** work_stuff_copy_to_from (to, from)
> *** 1200,1209 ****
>   
>     for (i = 0; i < from->numb; i++)
>       {
> !       int len = strlen (from->btypevec[i]) + 1;
>   
> !       to->btypevec[i] = xmalloc (len);
> !       memcpy (to->btypevec[i], from->btypevec[i], len);
>       }
>   
>     if (from->ntmpl_args)
> --- 1200,1214 ----
>   
>     for (i = 0; i < from->numb; i++)
>       {
> !       if (from->btypevec[i])
> !     {
> !       int len = strlen (from->btypevec[i]) + 1;
>   
> !       to->btypevec[i] = xmalloc (len);
> !       memcpy (to->btypevec[i], from->btypevec[i], len);
> !     }
> !       else
> !     to->btypevec[i] = NULL;
>       }
>   
>     if (from->ntmpl_args)
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]