+2020-08-05 Alan Modra <amodra@gmail.com>
+
+ PR 26337
+ * objdump.c (load_specific_debug_section): Don't malloc space for
+ section contents, use bfd_malloc_and_get_section.
+
2020-07-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
if (streq (section->filename, bfd_get_filename (abfd)))
return TRUE;
free (section->start);
+ section->start = NULL;
}
section->filename = bfd_get_filename (abfd);
alloced = amt = section->size + 1;
if (alloced != amt || alloced == 0)
{
- section->start = NULL;
free_debug_section (debug);
printf (_("\nSection '%s' has an invalid size: %#llx.\n"),
sanitize_string (section->name),
(unsigned long long) section->size);
return FALSE;
}
- section->start = contents = malloc (alloced);
- if (section->start == NULL
- || !bfd_get_full_section_contents (abfd, sec, &contents))
+ if (!bfd_malloc_and_get_section (abfd, sec, &contents))
{
free_debug_section (debug);
printf (_("\nCan't get contents for section '%s'.\n"),
sanitize_string (section->name));
return FALSE;
}
+ section->start = contents;
/* Ensure any string section has a terminating NUL. */
section->start[section->size] = 0;