forked from Imagelibrary/binutils-gdb
PR31692, objdump fails .debug_info size check
PR 31692 * objdump.c (load_specific_debug_section): Replace bfd_get_size check with bfd_section_size_insane. Call free_debug_section after printing error messages. Set section->start NULL when freeing.
This commit is contained in:
@@ -4286,6 +4286,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
|
|||||||
if (streq (section->filename, bfd_get_filename (abfd)))
|
if (streq (section->filename, bfd_get_filename (abfd)))
|
||||||
return true;
|
return true;
|
||||||
free (section->start);
|
free (section->start);
|
||||||
|
section->start = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
section->filename = bfd_get_filename (abfd);
|
section->filename = bfd_get_filename (abfd);
|
||||||
@@ -4297,13 +4298,12 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
|
|||||||
alloced = amt = section->size + 1;
|
alloced = amt = section->size + 1;
|
||||||
if (alloced != amt
|
if (alloced != amt
|
||||||
|| alloced == 0
|
|| alloced == 0
|
||||||
|| (bfd_get_size (abfd) != 0 && alloced >= bfd_get_size (abfd)))
|
|| bfd_section_size_insane (abfd, sec))
|
||||||
{
|
{
|
||||||
section->start = NULL;
|
|
||||||
free_debug_section (debug);
|
|
||||||
printf (_("\nSection '%s' has an invalid size: %#" PRIx64 ".\n"),
|
printf (_("\nSection '%s' has an invalid size: %#" PRIx64 ".\n"),
|
||||||
sanitize_string (section->name),
|
sanitize_string (section->name),
|
||||||
section->size);
|
section->size);
|
||||||
|
free_debug_section (debug);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4345,9 +4345,9 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
|
|||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
free_debug_section (debug);
|
|
||||||
printf (_("\nCan't get contents for section '%s'.\n"),
|
printf (_("\nCan't get contents for section '%s'.\n"),
|
||||||
sanitize_string (section->name));
|
sanitize_string (section->name));
|
||||||
|
free_debug_section (debug);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user