+2019-03-19 Nick Clifton <nickc@redhat.com>
+
+ PR 24360
+ * objdump.c (load_specific_debug_section): Check that the amount
+ of memory to be allocated matches the size of the section.
+
2019-03-13 Sudakshina Das <sudi.das@arm.com>
* readelf.c (get_aarch64_dynamic_type): Add case for
static const char *
sanitize_string (const char * in)
{
- static char * buffer = NULL;
- static unsigned int buffer_len = 0;
- const char * original = in;
- char * out;
+ static char * buffer = NULL;
+ static size_t buffer_len = 0;
+ const char * original = in;
+ char * out;
/* Paranoia. */
if (in == NULL)
bfd *abfd = (bfd *) file;
bfd_byte *contents;
bfd_size_type amt;
+ size_t alloced;
if (section->start != NULL)
{
section->address = bfd_get_section_vma (abfd, sec);
section->user_data = sec;
section->size = bfd_get_section_size (sec);
- amt = section->size + 1;
- if (amt == 0)
+ /* PR 24360: On 32-bit hosts sizeof (size_t) < sizeof (bfd_size_type). */
+ alloced = amt = section->size + 1;
+ if (alloced != amt || alloced == 0)
{
section->start = NULL;
free_debug_section (debug);
(unsigned long long) section->size);
return FALSE;
}
- section->start = contents = malloc (amt);
+ section->start = contents = malloc (alloced);
if (section->start == NULL
|| !bfd_get_full_section_contents (abfd, sec, &contents))
{