This is the mail archive of the binutils-cvs@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]

[binutils-gdb] Fix invalid memory access displayiing contents of sections.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bc303e5d6c2dd33086478f80fd1d3096d4e1bc01

commit bc303e5d6c2dd33086478f80fd1d3096d4e1bc01
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Feb 14 15:10:34 2017 +0000

    Fix invalid memory access displayiing contents of sections.
    
    	PR binutils/21159
    	* readelf.c (dump_section_as_strings): Reset the start address if
    	no decompression is perfromed.
    	(dump_section_as_bytes): Likewise.

Diff:
---
 binutils/ChangeLog |  7 +++++++
 binutils/readelf.c | 10 +++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 4f9bdfa..9d3f7e2 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,12 @@
 2017-02-14  Nick Clifton  <nickc@redhat.com>
 
+	PR binutils/21159
+	* readelf.c (dump_section_as_strings): Reset the start address if
+	no decompression is perfromed.
+	(dump_section_as_bytes): Likewise.
+
+2017-02-14  Nick Clifton  <nickc@redhat.com>
+
 	PR binutils/21158
 	* rddbg.c (read_symbol_stabs_debugging_info): Check for a null or
 	empty symbol name.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index c4bddcd..150b680 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12706,6 +12706,8 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file)
 	      return;
 	    }
 	}
+      else
+	start = real_start;
     }
 
   /* If the section being dumped has relocations against it the user might
@@ -12840,14 +12842,19 @@ dump_section_as_bytes (Elf_Internal_Shdr * section,
 	{
 	  if (uncompress_section_contents (& start, uncompressed_size,
 					   & new_size))
-	    section_size = new_size;
+	    {
+	      section_size = new_size;
+	    }
 	  else
 	    {
 	      error (_("Unable to decompress section %s\n"),
 		     printable_section_name (section));
+	      /* FIXME: Print the section anyway ?  */
 	      return;
 	    }
 	}
+      else
+	start = real_start;
     }
 
   if (relocate)
@@ -13014,6 +13021,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
 	      return 0;
 	    }
 	}
+
       section->size = size;
     }


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