summaryrefslogtreecommitdiff
path: root/binutils/patches/pr14493-readelf.patch
blob: 1bd9e3a03d3697218e72541ef14da168037c119d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Description: Check bad section index
Bug: http://sourceware.org/bugzilla/show_bug.cgi?id=14493
Index: binutils/binutils/readelf.c
===================================================================
--- binutils.orig/binutils/readelf.c	2012-10-28 16:32:57.669492867 +0400
+++ binutils/binutils/readelf.c	2012-10-28 18:13:56.322847064 +0400
@@ -8824,6 +8824,8 @@
 	sprintf (buff, "OS [0x%04x]", type & 0xffff);
       else if (type >= SHN_LORESERVE)
 	sprintf (buff, "RSV[0x%04x]", type & 0xffff);
+      else if (type >= elf_header.e_shnum)
+	sprintf (buff, "bad section index[%3d]", type);
       else
 	sprintf (buff, "%3d", type);
       break;