[PATCH] Fix crash in llvm-objdump with proc-specific sections
colinl at codeaurora.org
colinl at codeaurora.org
Tue Feb 17 14:33:16 PST 2015
Hi rafael, shankar.easwaran, sidneym,
getSection returns nullptr for some section types:
if (symb->st_shndx >= ELF::SHN_LORESERVE)
return nullptr;
but getSymbolAddress was dereferencing this without checking.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7704
Files:
include/llvm/Object/ELFObjectFile.h
test/tools/llvm-objdump/Inputs/proc-specific-section-elf
test/tools/llvm-objdump/proc-specific-section-elf.test
Index: include/llvm/Object/ELFObjectFile.h
===================================================================
--- include/llvm/Object/ELFObjectFile.h
+++ include/llvm/Object/ELFObjectFile.h
@@ -314,8 +314,11 @@
ESym->getType() == ELF::STT_FUNC)
Result &= ~1;
- if (Header->e_type == ELF::ET_REL)
- Result += EF.getSection(ESym)->sh_addr;
+ if (Header->e_type == ELF::ET_REL) {
+ auto Section = EF.getSection(ESym);
+ if (Section != nullptr)
+ Result += Section->sh_addr;
+ }
return object_error::success;
}
Index: test/tools/llvm-objdump/proc-specific-section-elf.test
===================================================================
--- test/tools/llvm-objdump/proc-specific-section-elf.test
+++ test/tools/llvm-objdump/proc-specific-section-elf.test
@@ -0,0 +1,3 @@
+// RUN: llvm-objdump -t %p/Inputs/proc-specific-section-elf | FileCheck %s
+
+CHECK: 00000000 *UND* 00000000 print
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7704.20109.patch
Type: text/x-patch
Size: 934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150217/e07de84f/attachment.bin>
More information about the llvm-commits
mailing list