This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Commit: PR 22510: Check for an absence of section headers when loading debug sections


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]