+2020-01-03 Nick Clifton <nickc@redhat.com>
+
+ PR 25308
+ * elf-properties.c (_bfd_elf_convert_gnu_properties): Check the
+ return value from bfd_malloc.
+ * elf32-arm.c (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
+ (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Likewise.
+ (elf32_arm_filter_cmse_symbols): Likewise.
+ (elf32_arm_write_section): Likewise.
+ * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
+ (bfd_mach_o_follow_dsym): Likewise.
+ * pef.c (bfd_pef_print_loader_section): Likewise.
+ (bfd_pef_scan_start_address): Likewise.
+ (bfd_pef_parse_function_stubs): Likewise.
+ (bfd_pef_parse_symbols): Likewise.
+
2020-01-03 Sergei Trofimovich <siarheit@google.com>
* elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
if (size > bfd_section_size (isec))
{
contents = (bfd_byte *) bfd_malloc (size);
+ if (contents == NULL)
+ return FALSE;
free (*ptr);
*ptr = contents;
}
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
-
BFD_ASSERT (tmp_name);
sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
-
BFD_ASSERT (tmp_name);
sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
/* Add symbol for veneer. */
tmp_name = (char *)
bfd_malloc ((bfd_size_type) strlen (ARM_BX_GLUE_ENTRY_NAME) + 1);
-
BFD_ASSERT (tmp_name);
sprintf (tmp_name, ARM_BX_GLUE_ENTRY_NAME, reg);
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen
(VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
-
BFD_ASSERT (tmp_name);
sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME,
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen
(STM32L4XX_ERRATUM_VENEER_ENTRY_NAME) + 10);
-
BFD_ASSERT (tmp_name);
sprintf (tmp_name, STM32L4XX_ERRATUM_VENEER_ENTRY_NAME,
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen
(VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
+ BFD_ASSERT (tmp_name);
for (sec = abfd->sections; sec != NULL; sec = sec->next)
{
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen
(STM32L4XX_ERRATUM_VENEER_ENTRY_NAME) + 10);
+ BFD_ASSERT (tmp_name);
for (sec = abfd->sections; sec != NULL; sec = sec->next)
{
maxnamelen = 128;
cmse_name = (char *) bfd_malloc (maxnamelen);
+ BFD_ASSERT (cmse_name);
+
for (src_count = 0; src_count < symcount; src_count++)
{
struct elf32_arm_link_hash_entry *cmse_hash;
unsigned int in_index, out_index;
bfd_vma add_to_offsets = 0;
+ if (edited_contents == NULL)
+ return FALSE;
for (in_index = 0, out_index = 0; in_index * 8 < input_size || edit_node;)
{
if (edit_node)
unsigned char *buf = bfd_malloc (1024);
unsigned long size = 1024;
+ if (buf == NULL)
+ return -1;
for (;;)
{
bfd_size_type nread = 0;
bottom = seg->fileoff + seg->filesize - offset;
top = seg->fileoff + seg->filesize - 4;
*rbuf = bfd_malloc (top - bottom);
+ if (*rbuf == NULL)
+ return -1;
*rlen = top - bottom;
memcpy (*rbuf, buf + size - *rlen, *rlen);
dsym_filename = (char *)bfd_malloc (strlen (base_bfd->filename)
+ strlen (dsym_subdir) + 1
+ strlen (base_basename) + 1);
+ if (dsym_filename == NULL)
+ return NULL;
+
sprintf (dsym_filename, "%s%s/%s",
base_bfd->filename, dsym_subdir, base_basename);
loaderlen = loadersec->size;
loaderbuf = bfd_malloc (loaderlen);
+ if (loaderbuf == NULL)
+ return -1;
if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0
|| bfd_bread ((void *) loaderbuf, loaderlen, abfd) != loaderlen
loaderlen = loadersec->size;
loaderbuf = bfd_malloc (loaderlen);
+ if (loaderbuf == NULL)
+ goto end;
+
if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0)
goto error;
if (bfd_bread ((void *) loaderbuf, loaderlen, abfd) != loaderlen)
(header.imported_library_count * sizeof (bfd_pef_imported_library));
imports = bfd_malloc
(header.total_imported_symbol_count * sizeof (bfd_pef_imported_symbol));
+ if (libraries == NULL || imports == NULL)
+ goto error;
if (loaderlen < (56 + (header.imported_library_count * 24)))
goto error;
{
codelen = codesec->size;
codebuf = bfd_malloc (codelen);
+ if (codebuf == NULL)
+ goto end;
if (bfd_seek (abfd, codesec->filepos, SEEK_SET) < 0)
goto end;
if (bfd_bread ((void *) codebuf, codelen, abfd) != codelen)
{
loaderlen = loadersec->size;
loaderbuf = bfd_malloc (loaderlen);
+ if (loaderbuf == NULL)
+ goto end;
if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0)
goto end;
if (bfd_bread ((void *) loaderbuf, loaderlen, abfd) != loaderlen)