| Index: src/codec/SkCodec_libico.cpp
 | 
| diff --git a/src/codec/SkCodec_libico.cpp b/src/codec/SkCodec_libico.cpp
 | 
| index 8c5a1b34120976e5d02c7fab1dad9c9185667771..daf368e292f01c4209de39e659e1534c37c0a3ba 100644
 | 
| --- a/src/codec/SkCodec_libico.cpp
 | 
| +++ b/src/codec/SkCodec_libico.cpp
 | 
| @@ -18,11 +18,10 @@
 | 
|  /*
 | 
|   * Checks the start of the stream to see if the image is an Ico or Cur
 | 
|   */
 | 
| -bool SkIcoCodec::IsIco(SkStream* stream) {
 | 
| +bool SkIcoCodec::IsIco(const char* buffer, size_t bytesRead) {
 | 
|      const char icoSig[] = { '\x00', '\x00', '\x01', '\x00' };
 | 
|      const char curSig[] = { '\x00', '\x00', '\x02', '\x00' };
 | 
| -    char buffer[sizeof(icoSig)];
 | 
| -    return stream->read(buffer, sizeof(icoSig)) == sizeof(icoSig) &&
 | 
| +    return bytesRead >= sizeof(icoSig) &&
 | 
|              (!memcmp(buffer, icoSig, sizeof(icoSig)) ||
 | 
|              !memcmp(buffer, curSig, sizeof(curSig)));
 | 
|  }
 | 
| @@ -139,10 +138,8 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
 | 
|          bytesRead += size;
 | 
|  
 | 
|          // Check if the embedded codec is bmp or png and create the codec
 | 
| -        const bool isPng = SkPngCodec::IsPng(embeddedStream);
 | 
| -        SkAssertResult(embeddedStream->rewind());
 | 
|          SkCodec* codec = nullptr;
 | 
| -        if (isPng) {
 | 
| +        if (SkPngCodec::IsPng((const char*) data->bytes(), data->size())) {
 | 
|              codec = SkPngCodec::NewFromStream(embeddedStream.detach());
 | 
|          } else {
 | 
|              codec = SkBmpCodec::NewFromIco(embeddedStream.detach());
 | 
| 
 |