Make sure the directory block array fits in the file

llvm-svn: 271011
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
index b04ccab..65ddcca 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
@@ -174,6 +174,10 @@
     return make_error<RawError>(raw_error_code::corrupt_file,
                                 "Too many directory blocks.");
 
+  // Make sure the directory block array fits within the file.
+  if (auto EC = checkOffset(BufferRef, getDirectoryBlockArray()))
+    return EC;
+
   return Error::success();
 }