diff options
| -rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/StreamReader.h | 3 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/StreamReader.h b/llvm/include/llvm/DebugInfo/CodeView/StreamReader.h index 0cd779419c5..a42cc8bc7b8 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/StreamReader.h +++ b/llvm/include/llvm/DebugInfo/CodeView/StreamReader.h @@ -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); diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp index 81762e7f879..9ef0a492e87 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp @@ -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; |

