mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 18:14:13 +08:00
Fix seg-fault running addr2line on a corrupt binary.
PR binutils/20891 * aoutx.h (find_nearest_line): Handle the case where the main file name and the directory name are both empty.
This commit is contained in:
parent
95a23284a3
commit
50455f1ab2
@ -1,3 +1,9 @@
|
|||||||
|
2016-12-01 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR binutils/20891
|
||||||
|
* aoutx.h (find_nearest_line): Handle the case where the main file
|
||||||
|
name and the directory name are both empty.
|
||||||
|
|
||||||
2016-11-30 Alan Modra <amodra@gmail.com>
|
2016-11-30 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* elf.c (get_program_header_size): Revert accidental change.
|
* elf.c (get_program_header_size): Revert accidental change.
|
||||||
|
16
bfd/aoutx.h
16
bfd/aoutx.h
@ -2666,7 +2666,7 @@ NAME (aout, find_nearest_line) (bfd *abfd,
|
|||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
*filename_ptr = abfd->filename;
|
*filename_ptr = abfd->filename;
|
||||||
*functionname_ptr = 0;
|
*functionname_ptr = NULL;
|
||||||
*line_ptr = 0;
|
*line_ptr = 0;
|
||||||
if (disriminator_ptr)
|
if (disriminator_ptr)
|
||||||
*disriminator_ptr = 0;
|
*disriminator_ptr = 0;
|
||||||
@ -2811,9 +2811,17 @@ NAME (aout, find_nearest_line) (bfd *abfd,
|
|||||||
*filename_ptr = main_file_name;
|
*filename_ptr = main_file_name;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf (buf, "%s%s", directory_name, main_file_name);
|
if (buf == NULL)
|
||||||
*filename_ptr = buf;
|
/* PR binutils/20891: In a corrupt input file both
|
||||||
buf += filelen + 1;
|
main_file_name and directory_name can be empty... */
|
||||||
|
* filename_ptr = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf (buf, filelen + 1, "%s%s", directory_name,
|
||||||
|
main_file_name);
|
||||||
|
*filename_ptr = buf;
|
||||||
|
buf += filelen + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user