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 a buffer overrun when parsing a corrupt MIPS ELF binary.


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

commit f17e9d8ab58474cfa24910f9066f3b9823e190e7
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Sep 5 12:09:14 2017 +0100

    Fix a buffer overrun when parsing a corrupt MIPS ELF binary.
    
    	PR 21995
    	* readelf.c (process_mips_specific): Add checks for a NULL data
    	pointer.

Diff:
---
 binutils/ChangeLog | 6 ++++++
 binutils/readelf.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 92d8602..53ac9fe 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-05  Nick Clifton  <nickc@redhat.com>
+
+	PR 21995
+	* readelf.c (process_mips_specific): Add checks for a NULL data
+	pointer.
+
 2017-09-05  Alexander Fedotov <alexander.fedotov@nxp.com>
 	    Edmar Wienskoski <edmar.wienskoski@nxp.com
 
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 571da2c..d61417a 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -15324,7 +15324,7 @@ process_mips_specific (FILE * file)
 	      printf ("\n");
 	    }
 
-	  if (ent < end)
+	  if (data != NULL && ent < end)
 	    {
 	      printf (_(" Local entries:\n"));
 	      printf ("  %*s %10s %*s\n",
@@ -15854,7 +15854,7 @@ process_mips_specific (FILE * file)
 	}
       printf ("\n");
 
-      if (ent < local_end)
+      if (data != NULL && ent < local_end)
 	{
 	  printf (_(" Local entries:\n"));
 	  printf ("  %*s %10s %*s\n",
@@ -15870,7 +15870,7 @@ process_mips_specific (FILE * file)
 	  printf ("\n");
 	}
 
-      if (gotsym < symtabno)
+      if (data != NULL && gotsym < symtabno)
 	{
 	  int sym_width;


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