diff --git a/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp index a3db147f57ec..acc92f90d26a 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp @@ -26,9 +26,9 @@ MappedBlockStream::MappedBlockStream(uint32_t StreamIdx, const PDBFile &File) : Error MappedBlockStream::readBytes(uint32_t Offset, uint32_t Size, ArrayRef &Buffer) const { // Make sure we aren't trying to read beyond the end of the stream. - if (Buffer.size() > StreamLength) + if (Size > StreamLength) return make_error(raw_error_code::insufficient_buffer); - if (Offset > StreamLength - Buffer.size()) + if (Offset > StreamLength - Size) return make_error(raw_error_code::insufficient_buffer); if (tryReadContiguously(Offset, Size, Buffer))