[llvm] r341485 - Handle zero-length debug directory entries.
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 5 11:01:05 PDT 2018
Author: nico
Date: Wed Sep 5 11:01:04 2018
New Revision: 341485
URL: http://llvm.org/viewvc/llvm-project?rev=341485&view=rev
Log:
Handle zero-length debug directory entries.
Part of https://reviews.llvm.org/D51652 (tests will be in the lld repo)
Modified:
llvm/trunk/lib/Object/COFFObjectFile.cpp
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=341485&r1=341484&r2=341485&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Wed Sep 5 11:01:04 2018
@@ -616,6 +616,8 @@ std::error_code COFFObjectFile::initBase
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::initDebu
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();
}
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=341485&r1=341484&r2=341485&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Wed Sep 5 11:01:04 2018
@@ -751,7 +751,7 @@ void COFFDumper::printCOFFDebugDirectory
W.printNumber("PDBAge", DebugInfo->PDB70.Age);
W.printString("PDBFileName", PDBFileName);
}
- } else {
+ } else if (D.SizeOfData != 0) {
// FIXME: Type values of 12 and 13 are commonly observed but are not in
// the documented type enum. Figure out what they mean.
ArrayRef<uint8_t> RawData;
More information about the llvm-commits
mailing list