summaryrefslogtreecommitdiff
path: root/bfd/elf-properties.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-01-03 14:41:02 +0000
committerNick Clifton <nickc@redhat.com>2020-01-03 14:41:02 +0000
commit7a0fb7be96e0ce79e1ae429bc1ba913e5244d537 (patch)
tree2cd6d1c387030ff641bee30455eee384d516d7a9 /bfd/elf-properties.c
parenta2322019f5669e80444cdf6a8222f94a45301b3a (diff)
downloadbinutils-gdb-7a0fb7be96e0ce79e1ae429bc1ba913e5244d537.tar.gz
Fix potential illegal memory access failures in the BFD library by ensuring that the return value from bfd_malloc() is checked before it is used.
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.
Diffstat (limited to 'bfd/elf-properties.c')
-rw-r--r--bfd/elf-properties.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index a42abc44dd5..76ddad60371 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -703,6 +703,8 @@ _bfd_elf_convert_gnu_properties (bfd *ibfd, asection *isec,
if (size > bfd_section_size (isec))
{
contents = (bfd_byte *) bfd_malloc (size);
+ if (contents == NULL)
+ return FALSE;
free (*ptr);
*ptr = contents;
}