* [binutils-gdb] Fix: Segmentation fault caused by npd in objdump
@ 2023-09-29 14:25 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-09-29 14:25 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a78c3c9717e8fa98b11482f948e71c6d1d9d0e44
commit a78c3c9717e8fa98b11482f948e71c6d1d9d0e44
Author: Nick Clifton <nickc@redhat.com>
Date: Fri Sep 29 15:24:26 2023 +0100
Fix: Segmentation fault caused by npd in objdump
PR 30906
* elf.c (_bfd_elf_slurp_version_tables): Test that the verref section header has been initialised before using it.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elf.c | 8 ++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ed9db240eb5..6c4e3e52953 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2023-09-29 Nick Clifton <nickc@redhat.com>
+
+ PR 30906
+ * elf.c (_bfd_elf_slurp_version_tables): Test that the verref
+ section header has been initialised before using it.
+
2023-09-28 Nick Clifton <nickc@redhat.com>
PR 30886
diff --git a/bfd/elf.c b/bfd/elf.c
index 2bd236b405a..d5c570f4b8c 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9482,7 +9482,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
= elf_tdata (abfd)->dt_strtab + iverneed->vn_file;
else
iverneed->vn_filename = NULL;
- }
+ }
+ else if (hdr == NULL)
+ goto error_return_bad_verref;
else
iverneed->vn_filename
= bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
@@ -9525,6 +9527,8 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
else
ivernaux->vna_nodename = NULL;
}
+ else if (hdr == NULL)
+ goto error_return_bad_verref;
else
ivernaux->vna_nodename
= bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
@@ -9555,7 +9559,7 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
iverneed->vn_nextref = NULL;
if (iverneed->vn_next == 0)
break;
- if (i + 1 < hdr->sh_info)
+ if (hdr != NULL && (i + 1 < hdr->sh_info))
iverneed->vn_nextref = iverneed + 1;
if (iverneed->vn_next
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-29 14:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-29 14:25 [binutils-gdb] Fix: Segmentation fault caused by npd in objdump 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).