diff options
| author | Mark Wielaard <[email protected]> | 2017-04-05 17:09:27 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2017-04-05 17:09:27 +0200 |
| commit | caf135b7f49f9f3499c952b352493cf561ae12bd (patch) | |
| tree | d259d672bd575361f126bab6f779e8355bd73e61 /src | |
| parent | f339da994fda25b51cddc3d88182f249b75f89ff (diff) | |
elflint: Support checking ELF files with compressed sections.
Simply unconditionally uncompress any section to make sure indexes between
sections check out. Add some testcases with various compressed sections.
https://sourceware.org/bugzilla/show_bug.cgi?id=21332
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/elflint.c | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e022503b..a1bec198 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2017-04-05 Mark Wielaard <[email protected]> + + * elflint.c (check_elf_header): Decompress all sections. + 2017-03-28 Mark Wielaard <[email protected]> * elflint (check_group): Don't check if there is no flag word. diff --git a/src/elflint.c b/src/elflint.c index e0c65b6a..51e53c23 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -456,7 +456,9 @@ invalid number of section header table entries\n")); ERROR (gettext ("invalid section header index\n")); } - /* Check the shdrs actually exist. */ + /* Check the shdrs actually exist. And uncompress them before + further checking. Indexes between sections reference the + uncompressed data. */ unsigned int scnt; Elf_Scn *scn = NULL; for (scnt = 1; scnt < shnum; ++scnt) @@ -464,6 +466,9 @@ invalid number of section header table entries\n")); scn = elf_nextscn (ebl->elf, scn); if (scn == NULL) break; + /* If the section wasn't compressed this does nothing, but + returns an error. We don't care. */ + elf_compress (scn, 0, 0); } if (scnt < shnum) ERROR (gettext ("Can only check %u headers, shnum was %u\n"), scnt, shnum); |
