diff options
author | paulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 18:12:07 +0000 |
---|---|---|
committer | paulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 18:12:07 +0000 |
commit | b018b7c8402c7eba1f12818dfbfa50937679c7cc (patch) | |
tree | 6505b3b8933077c21a92dcb2378575c9eceab19a /courgette | |
parent | e41cd197677108d3bf9e7324ce5d5353f33af5e0 (diff) | |
download | chromium_src-b018b7c8402c7eba1f12818dfbfa50937679c7cc.zip chromium_src-b018b7c8402c7eba1f12818dfbfa50937679c7cc.tar.gz chromium_src-b018b7c8402c7eba1f12818dfbfa50937679c7cc.tar.bz2 |
Fixed a bug where courgette would fail if a relocation entry pointed to a section that isn't a progbits section, e.g., an init_array section
This fix will check whether the relocation address is inside of an ELF section that isn't PROGBITS, and skip the relocation address if it is inside.
BUG=246763
Review URL: https://chromiumcodereview.appspot.com/16658003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette')
-rw-r--r-- | courgette/disassembler_elf_32_x86.cc | 23 | ||||
-rw-r--r-- | courgette/types_elf.h | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/courgette/disassembler_elf_32_x86.cc b/courgette/disassembler_elf_32_x86.cc index 6e3935c..a857c96 100644 --- a/courgette/disassembler_elf_32_x86.cc +++ b/courgette/disassembler_elf_32_x86.cc @@ -305,8 +305,29 @@ CheckBool DisassemblerElf32X86::ParseFile(AssemblyProgram* program) { return false; file_offset = section_header->sh_offset + section_header->sh_size; break; - default: + case SHT_NOBITS: + // Fall through + case SHT_INIT_ARRAY: + // Fall through + case SHT_FINI_ARRAY: + while (current_abs_offset != end_abs_offset && + *current_abs_offset >= section_header->sh_offset && + *current_abs_offset < + (section_header->sh_offset + section_header->sh_size)) { + // Skip any abs_offsets appear in the unsupported INIT_ARRAY section + VLOG(1) << "Skipping relocation entry for unsupported section: " << + section_header->sh_type; + current_abs_offset++; + } break; + default: + if (current_abs_offset != end_abs_offset && + *current_abs_offset >= section_header->sh_offset && + *current_abs_offset < + (section_header->sh_offset + section_header->sh_size)) + VLOG(1) << "Relocation address in unrecognized ELF section: " << \ + section_header->sh_type; + break; } } diff --git a/courgette/types_elf.h b/courgette/types_elf.h index 707f481..9708486 100644 --- a/courgette/types_elf.h +++ b/courgette/types_elf.h @@ -82,6 +82,8 @@ enum sh_type_values { SHT_REL = 9, SHT_SHLIB = 10, SHT_DYNSYM = 11, + SHT_INIT_ARRAY = 14, + SHT_FINI_ARRAY = 15, SHT_LOPROC = 0x70000000, SHT_HIPROC = 0x7fffffff, SHT_LOUSER = 0x80000000, |