Add bounds check in PCHReader. when reading source file entry record
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98873 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 63146a2..36cddd3 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -902,6 +902,11 @@
return Failure;
}
+ if (Record.size() < 8) {
+ Error("source location entry is incorrect");
+ return Failure;
+ }
+
FileID FID = SourceMgr.createFileID(File,
SourceLocation::getFromRawEncoding(Record[1]),
(SrcMgr::CharacteristicKind)Record[2],