forked from Imagelibrary/binutils-gdb
Re: PR31692, objdump fails .debug_info size check
The fuzzers found a hole. bfd_section_size_insane doesn't check !SEC_HAS_CONTENTS sections against file size for obvious reasons, which allows fuzzed debug sections to be stupidly large. Real debug sections of course always have contents. PR 31692 * objdump.c (load_specific_debug_section): Don't allow sections without contents.
This commit is contained in:
@@ -4307,6 +4307,9 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = false;
|
||||||
|
if ((sec->flags & SEC_HAS_CONTENTS) != 0)
|
||||||
|
{
|
||||||
section->start = contents = xmalloc (alloced);
|
section->start = contents = xmalloc (alloced);
|
||||||
/* Ensure any string section has a terminating NUL. */
|
/* Ensure any string section has a terminating NUL. */
|
||||||
section->start[section->size] = 0;
|
section->start[section->size] = 0;
|
||||||
@@ -4342,6 +4345,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = bfd_get_full_section_contents (abfd, sec, &contents);
|
ret = bfd_get_full_section_contents (abfd, sec, &contents);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user