[llvm] r272043 - [pdb] Fix a potential overflow and remove unnecessary comments.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 11:42:40 PDT 2016
Author: zturner
Date: Tue Jun 7 13:42:39 2016
New Revision: 272043
URL: http://llvm.org/viewvc/llvm-project?rev=272043&view=rev
Log:
[pdb] Fix a potential overflow and remove unnecessary comments.
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h
llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h?rev=272043&r1=272042&r2=272043&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h Tue Jun 7 13:42:39 2016
@@ -60,6 +60,9 @@ public:
return Error::success();
}
+ if (NumElements > UINT32_MAX/sizeof(T))
+ return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
+
if (auto EC = readBytes(Bytes, NumElements * sizeof(T)))
return EC;
Array = ArrayRef<T>(reinterpret_cast<const T *>(Bytes.data()), NumElements);
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp?rev=272043&r1=272042&r2=272043&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp Tue Jun 7 13:42:39 2016
@@ -210,10 +210,7 @@ Error PDBFile::parseStreamData() {
if (DirectoryStream)
return Error::success();
- // bool SeenNumStreams = false;
uint32_t NumStreams = 0;
- // uint32_t StreamIdx = 0;
- // uint64_t DirectoryBytesRead = 0;
const SuperBlock *SB = Context->SB;
More information about the llvm-commits
mailing list