diff options
author | 2014-10-21 08:06:05 -0700 | |
---|---|---|
committer | 2014-10-21 08:06:06 -0700 | |
commit | dd5a1e094c19fa10202c37c50a1f799e5af5dac0 (patch) | |
tree | 789aedc66742e29389bd66f85803285eb0b8e362 | |
parent | c0651c14ed9dc9015d8882885ee42a3c572e8e7e (diff) |
Check SkStream::isAtEnd before attempting to read.
In FrontBufferedStream, when attempting to read and buffer more
data, do not try to read if the underlying stream is at the end.
Prevents a bug where we continue trying to read a stream that
has nothing more to read.
Review URL: https://codereview.chromium.org/665303002
-rw-r--r-- | src/utils/SkFrontBufferedStream.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp index 9a666dcc7e..0922960851 100644 --- a/src/utils/SkFrontBufferedStream.cpp +++ b/src/utils/SkFrontBufferedStream.cpp @@ -176,7 +176,7 @@ size_t FrontBufferedStream::read(void* voidDst, size_t size) { // Buffer any more data that should be buffered, and copy it to the // destination. - if (size > 0 && fBufferedSoFar < fBufferSize) { + if (size > 0 && fBufferedSoFar < fBufferSize && !fStream->isAtEnd()) { const size_t buffered = this->bufferAndWriteTo(dst, size); // Update the remaining number of bytes needed to read |