aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/readelf.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index a21e36e..a528db4 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-24 Maciej W. Rozycki <macro@imgtec.com>
+
+ * readelf.c (process_version_sections) <SHT_GNU_verdef>: Limit
+ the number of entries processed by the section size. Don't
+ break out of the loop if `ent.vd_next' is 0.
+
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* testsuite/binutils-all/dw5.S: New file.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 9caa4da..cb0da10 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -9994,6 +9994,7 @@ process_version_sections (FILE * file)
Elf_External_Verdef * edefs;
unsigned int idx;
unsigned int cnt;
+ unsigned int end;
char * endbuf;
found = 1;
@@ -10015,7 +10016,10 @@ process_version_sections (FILE * file)
break;
endbuf = (char *) edefs + section->sh_size;
- for (idx = cnt = 0; cnt < section->sh_info; ++cnt)
+ /* PR 17531: file: id:000001,src:000172+005151,op:splice,rep:2. */
+ end = (section->sh_info < section->sh_size
+ ? section->sh_info : section->sh_size);
+ for (idx = cnt = 0; cnt < end; ++cnt)
{
char * vstart;
Elf_External_Verdef * edef;
@@ -10094,8 +10098,9 @@ process_version_sections (FILE * file)
if (j < ent.vd_cnt)
printf (_(" Version def aux past end of section\n"));
- /* PR 17531: file: id:000001,src:000172+005151,op:splice,rep:2. */
- if (idx + ent.vd_next <= idx)
+ /* PR 17531:
+ file: id:000001,src:000172+005151,op:splice,rep:2. */
+ if (idx + ent.vd_next < idx)
break;
idx += ent.vd_next;