OSDN Git Service

Make sure the directory block array fits in the file
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 27 May 2016 16:16:45 +0000 (16:16 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 27 May 2016 16:16:45 +0000 (16:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271011 91177308-0d34-0410-b5e6-96231b3b80d8

lib/DebugInfo/PDB/Raw/PDBFile.cpp

index b04ccab..65ddcca 100644 (file)
@@ -174,6 +174,10 @@ Error PDBFile::parseFileHeaders() {
     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();
 }