Am 24.06.2014 22:05, schrieb Paul Gortmaker:
> We see the following on a 32bit gcc installed on 64 bit host:
> 
>   Reading symbols from ./i586-pokymllib32-linux-gcc...done.
>   (gdb) run
>   Starting program: 
> x86-pokymllib32-linux/lib32-gcc/4.9.0-r0/image/usr/bin/i586-pokymllib32-linux-gcc
> 
>   Program received signal SIGSEGV, Segmentation fault.
>   0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
>   (gdb) bt
>   #0  0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
>   #1  0x0804b73c in set_multilib_dir () at gcc-4.9.0/gcc/gcc.c:7827
>   #2  main (argc=1, argv=0xffffd504) at gcc-4.9.0/gcc/gcc.c:6688
>   (gdb)
> 
> The problem arises because we conditionally assign the pointer we
> eventually free, and the conditional may assign the pointer to the
> non-malloc'd internal string "." which fails when we free it here:
> 
>    if (multilib_dir == NULL && multilib_os_dir != NULL
>        && strcmp (multilib_os_dir, ".") == 0)
>      {
>        free (CONST_CAST (char *, multilib_os_dir));
>        ...
> 
> As suggested by Jakub, ensure the "." case is also malloc'd via
> xstrdup() and hence the pointer for the "." case can be freed.

I tested the very same test and didn't find any issues. This should go to the
trunk and the active branches (but I cannot approve it).

  Matthias

Reply via email to