diff options
author | Will Harris <wfh@chromium.org> | 2015-03-02 13:14:25 -0800 |
---|---|---|
committer | Will Harris <wfh@chromium.org> | 2015-03-02 21:16:44 +0000 |
commit | 3e6fa973958cb37622aa882f2c13b6927228e4fc (patch) | |
tree | 2aeae1d11bd311a04ed01dca07867ac4160bd72d /courgette/disassembler_elf_32_x86.cc | |
parent | 94b8fe46a0abf285a0c39cd36007de0236dd7e97 (diff) | |
download | chromium_src-3e6fa973958cb37622aa882f2c13b6927228e4fc.zip chromium_src-3e6fa973958cb37622aa882f2c13b6927228e4fc.tar.gz chromium_src-3e6fa973958cb37622aa882f2c13b6927228e4fc.tar.bz2 |
Fix courgette ELF x86 dissembler
Courgette cannot parse files that have out of order NOBITS sections and instead
will crash. The solution to this is to skip them and encode them as raw bytes.
Also, courgette has a bug where it incorrectly emits ElfRelocationInstruction
instructions even when there are no valid R_386_RELATIVE relocations in the
file.
Added a test file that exhibits both of these symptoms.
BUG=424820,423925
TEST=courgette_unittests
R=dgarrett@chromium.org, tommi@chromium.org
Review URL: https://codereview.chromium.org/664803002
Cr-Commit-Position: refs/heads/master@{#318764}
Diffstat (limited to 'courgette/disassembler_elf_32_x86.cc')
-rw-r--r-- | courgette/disassembler_elf_32_x86.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/courgette/disassembler_elf_32_x86.cc b/courgette/disassembler_elf_32_x86.cc index 74496d3..d2c1c86 100644 --- a/courgette/disassembler_elf_32_x86.cc +++ b/courgette/disassembler_elf_32_x86.cc @@ -91,6 +91,9 @@ CheckBool DisassemblerElf32X86::ParseRelocationSection( uint32 section_relocs_count = section_header->sh_size / section_header->sh_entsize; + if (abs32_locations_.empty()) + match = false; + if (abs32_locations_.size() > section_relocs_count) match = false; |