Index: src/images/SkImageDecoder_libico.cpp |
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp |
index b14e19614ceca7c65ac4567c6983d4835c6d9844..f4e17b9643d9cbd0e26cf2457ab048c69ebcd0b2 100644 |
--- a/src/images/SkImageDecoder_libico.cpp |
+++ b/src/images/SkImageDecoder_libico.cpp |
@@ -73,15 +73,19 @@ static int calculateRowBytesFor8888(int w, int bitCount) |
return 0; |
} |
+// Defined in SkImageDecoder.cpp |
+extern size_t copy_stream_to_storage(SkAutoMalloc* storage, SkStream* stream); |
+ |
bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) |
{ |
- size_t length = stream->getLength(); |
- SkAutoMalloc autoMal(length); |
- unsigned char* buf = (unsigned char*)autoMal.get(); |
- if (stream->read((void*)buf, length) != length) { |
+ SkAutoMalloc autoMal; |
+ const size_t length = copy_stream_to_storage(&autoMal, stream); |
+ if (0 == length) { |
return false; |
} |
+ unsigned char* buf = (unsigned char*)autoMal.get(); |
+ |
//these should always be the same - should i use for error checking? - what about files that have some |
//incorrect values, but still decode properly? |
int reserved = read2Bytes(buf, 0); // 0 |