Index: src/images/SkImageDecoder_libico.cpp |
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp |
index 4d19714a11b20c134aa9e6e38c3849529b50f798..513a1b59c06a9a870d9b785df668cbf140b21e01 100644 |
--- a/src/images/SkImageDecoder_libico.cpp |
+++ b/src/images/SkImageDecoder_libico.cpp |
@@ -407,7 +407,9 @@ static bool is_ico(SkStreamRewindable* stream) { |
// FIXME: Is that required and sufficient? |
SkAutoMalloc autoMal(4); |
unsigned char* buf = (unsigned char*)autoMal.get(); |
- stream->read((void*)buf, 4); |
+ if (stream->read((void*)buf, 4) < 4) { |
+ return false; |
+ } |
int reserved = read2Bytes(buf, 0); |
int type = read2Bytes(buf, 2); |
if (reserved != 0 || type != 1) { |