diff options
| author | Zachary Turner <zturner@google.com> | 2016-05-27 20:17:33 +0000 | 
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-05-27 20:17:33 +0000 | 
| commit | 7dd42598be026bd00c10ff876ea92da557f812a4 (patch) | |
| tree | b7147e7a81861cd216342adbc5d90967cb3250e1 /llvm/lib/DebugInfo/PDB | |
| parent | 6481a0f020a7834abb391760556c3d54f57cc6ab (diff) | |
| download | bcm5719-llvm-7dd42598be026bd00c10ff876ea92da557f812a4.tar.gz bcm5719-llvm-7dd42598be026bd00c10ff876ea92da557f812a4.zip | |
[pdb] Fix size check when reading stream bytes.
We were accidentally bounds checking the read against the output
ArrayRef instead of against the size of the read.
llvm-svn: 271040
Diffstat (limited to 'llvm/lib/DebugInfo/PDB')
| -rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp index a3db147f57e..acc92f90d26 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<uint8_t> &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<RawError>(raw_error_code::insufficient_buffer); -  if (Offset > StreamLength - Buffer.size()) +  if (Offset > StreamLength - Size)      return make_error<RawError>(raw_error_code::insufficient_buffer);    if (tryReadContiguously(Offset, Size, Buffer)) | 

