summaryrefslogtreecommitdiffstats
path: root/courgette/disassembler_elf_32_x86.cc
diff options
context:
space:
mode:
authorpaulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 18:12:07 +0000
committerpaulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 18:12:07 +0000
commitb018b7c8402c7eba1f12818dfbfa50937679c7cc (patch)
tree6505b3b8933077c21a92dcb2378575c9eceab19a /courgette/disassembler_elf_32_x86.cc
parente41cd197677108d3bf9e7324ce5d5353f33af5e0 (diff)
downloadchromium_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/disassembler_elf_32_x86.cc')
-rw-r--r--courgette/disassembler_elf_32_x86.cc23
1 files changed, 22 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;
}
}