1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

Handle zero-length debug directory entries.

Part of https://reviews.llvm.org/D51652 (tests will be in the lld repo)

llvm-svn: 341485
This commit is contained in:
Nico Weber 2018-09-05 18:01:04 +00:00
parent 42bcf8cc7b
commit 9ce85d59e4
2 changed files with 7 additions and 5 deletions

View File

@ -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();
}

View File

@ -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;