Correct readelf e_shstrndx range check
authorAlan Modra <amodra@gmail.com>
Wed, 22 Aug 2018 00:34:58 +0000 (10:04 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 22 Aug 2018 06:07:00 +0000 (15:37 +0930)
commite8a648884df318b3c6be170ecdc9c42f79e56bd0
tree160fb2d933c7f25c7b48f9fe8620c060a73b508a
parentac1e2e51c0927676dc87f0e090c6d8e4c42f297e
Correct readelf e_shstrndx range check

Fixes a bogus out of range error:
  Number of section headers:         0 (210016)
  Section header string table index: 1 <corrupt: out of range>

Caused due to e_shnum remaining as zero rather than being updated to
the value from section_header[0].sh_info at the point where we range
check e_shstrndx.

* readelf.c (process_file_header): Assign updated values from
section_header[0] fields to e_phnum, e_shnum and e_shstrndx
during printing of header.  Correct e_shstrndx range check.
Remove unnecessary casts and use %u rather than %ld for
unsigned int header fields.  Don't print a random %lx when
reporting an unknown EI_VERSION.
binutils/ChangeLog
binutils/readelf.c
This page took 0.024096 seconds and 4 git commands to generate.