This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Commit: PR 22510: Check for an absence of section headers when loading debug sections
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Thu, 30 Nov 2017 10:24:39 +0000
- Subject: Commit: PR 22510: Check for an absence of section headers when loading debug sections
- Authentication-results: sourceware.org; auth=none
Hi Guys,
I am checking in the patch below as a fix for PR 22510. It makes the
load_debug_section function in readelf fail if there are no section
headers available.
Cheers
Nick
binutils/ChangeLog
2017-11-30 Nick Clifton <nickc@redhat.com>
PR 22510
* readelf.c (load_debug_section): Fail if there are no section
headers available.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index a1f43e612a..e0230c7cc7 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -13574,6 +13574,10 @@ load_debug_section (enum dwarf_section_display_enum debug, void * data)
Elf_Internal_Shdr * sec;
Filedata * filedata = (Filedata *) data;
+ /* Without section headers we cannot find any sections. */
+ if (filedata->section_headers == NULL)
+ return FALSE;
+
if (filedata->string_table == NULL)
{
Elf_Internal_Shdr * strs;