aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-09-05 12:09:14 +0100
committerNick Clifton <nickc@redhat.com>2017-09-05 12:09:14 +0100
commitf17e9d8ab58474cfa24910f9066f3b9823e190e7 (patch)
tree47779b7680fc51d43126dd992c357897e5a07ae9
parent22916b0786336394bf84f68ba71875ac3cd48fea (diff)
downloadfsf-binutils-gdb-f17e9d8ab58474cfa24910f9066f3b9823e190e7.zip
fsf-binutils-gdb-f17e9d8ab58474cfa24910f9066f3b9823e190e7.tar.gz
fsf-binutils-gdb-f17e9d8ab58474cfa24910f9066f3b9823e190e7.tar.bz2
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.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/readelf.c6
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;