Index: src/images/SkImageDecoder_libico.cpp |
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp |
index f75d80439f5c3cc2b07baed38fff90d79acfda4f..7855546a2ccb5d849e4405c184a6d9a671d99b55 100644 |
--- a/src/images/SkImageDecoder_libico.cpp |
+++ b/src/images/SkImageDecoder_libico.cpp |
@@ -164,6 +164,10 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) |
SkMemoryStream subStream(buf + offset, size, false); |
SkAutoTDelete<SkImageDecoder> otherDecoder(SkImageDecoder::Factory(&subStream)); |
if (otherDecoder.get() != NULL) { |
+ // Disallow nesting ICO files within one another |
reed1
2014/08/26 17:53:34
Can we add a test case/data for this?
|
+ if (otherDecoder->getFormat() == SkImageDecoder::kICO_Format) { |
scroggo
2014/10/14 22:58:23
We could be more aggressive here; I think the only
|
+ return false; |
+ } |
// Set fields on the other decoder to be the same as this one. |
this->copyFieldsToOther(otherDecoder.get()); |
if(otherDecoder->decode(&subStream, bm, this->getDefaultPref(), mode)) { |