summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-09-05 18:01:04 +0000
committerNico Weber <nicolasweber@gmx.de>2018-09-05 18:01:04 +0000
commit893c646938e906a20d8418f60f15a73257921c05 (patch)
treea202177d0972b13654541a1d0c12e24ab21a499f /llvm/lib/Object/COFFObjectFile.cpp
parentf9f7fa9d038001b94441ca77c2719cddebdabd24 (diff)
downloadbcm5719-llvm-893c646938e906a20d8418f60f15a73257921c05.tar.gz
bcm5719-llvm-893c646938e906a20d8418f60f15a73257921c05.zip
Handle zero-length debug directory entries.
Part of https://reviews.llvm.org/D51652 (tests will be in the lld repo) llvm-svn: 341485
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index dfb95edce92..f09401307b4 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -616,6 +616,8 @@ std::error_code COFFObjectFile::initBaseRelocPtr() {
IntPtr);
BaseRelocEnd = reinterpret_cast<coff_base_reloc_block_header *>(
IntPtr + DataEntry->Size);
+ // FIXME: Verify the section containing BaseRelocHeader has at least
+ // DataEntry->Size bytes after DataEntry->RelativeVirtualAddress.
return std::error_code();
}
@@ -637,10 +639,10 @@ std::error_code COFFObjectFile::initDebugDirectoryPtr() {
if (std::error_code EC = getRvaPtr(DataEntry->RelativeVirtualAddress, IntPtr))
return EC;
DebugDirectoryBegin = reinterpret_cast<const debug_directory *>(IntPtr);
- if (std::error_code EC = getRvaPtr(
- DataEntry->RelativeVirtualAddress + DataEntry->Size, IntPtr))
- return EC;
- DebugDirectoryEnd = reinterpret_cast<const debug_directory *>(IntPtr);
+ DebugDirectoryEnd = reinterpret_cast<const debug_directory *>(
+ IntPtr + DataEntry->Size);
+ // FIXME: Verify the section containing DebugDirectoryBegin has at least
+ // DataEntry->Size bytes after DataEntry->RelativeVirtualAddress.
return std::error_code();
}
OpenPOWER on IntegriCloud