* [binutils-gdb] Fix a dereference of NULL when scanning the symbol hashes array in the ARM linker.
@ 2022-12-06 11:24 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2022-12-06 11:24 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=83f18e5ebe627163f744215d3760a8eaacee6ec1
commit 83f18e5ebe627163f744215d3760a8eaacee6ec1
Author: Nick Clifton <nickc@redhat.com>
Date: Tue Dec 6 11:24:12 2022 +0000
Fix a dereference of NULL when scanning the symbol hashes array in the ARM linker.
PR 29852
* elf32-arm.c (cmse_scan): Check for NULL entries in the
sym_hashes array.
(elf32_arm_gc_mark_extra_sections): Likewise.
Diff:
---
bfd/ChangeLog | 7 +++++++
bfd/elf32-arm.c | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ee8eaf01d42..da2a30a9463 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2022-12-06 Nick Clifton <nickc@redhat.com>
+
+ PR 29852
+ * elf32-arm.c (cmse_scan): Check for NULL entries in the
+ sym_hashes array.
+ (elf32_arm_gc_mark_extra_sections): Likewise.
+
2022-12-05 Nick Clifton <nickc@redhat.com>
PR 29848
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index c7d73171e62..86cc961f73a 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -6008,6 +6008,9 @@ cmse_scan (bfd *input_bfd, struct elf32_arm_link_hash_table *htab,
else
{
cmse_hash = elf32_arm_hash_entry (sym_hashes[i - ext_start]);
+ if (cmse_hash == NULL)
+ continue;
+
sym_name = (char *) cmse_hash->root.root.root.string;
if (!startswith (sym_name, CMSE_PREFIX))
continue;
@@ -15987,6 +15990,8 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
for (i = ext_start; i < sym_count; i++)
{
cmse_hash = elf32_arm_hash_entry (sym_hashes[i - ext_start]);
+ if (cmse_hash == NULL)
+ continue;
/* Assume it is a special symbol. If not, cmse_scan will
warn about it and user can do something about it. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-06 11:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 11:24 [binutils-gdb] Fix a dereference of NULL when scanning the symbol hashes array in the ARM linker Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).