Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: src/utils/SkFrontBufferedStream.cpp

Issue 665303002: Check SkStream::isAtEnd before attempting to read. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkFrontBufferedStream.cpp
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index 8cb3931082c75d268e793212a73f688a1dbe227f..80a2bcfce32a2d27d2c7124c6117806b2548a11f 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -175,7 +175,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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698