Index: third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp |
diff --git a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp |
index ee02e3133d214bee944b9d1b4757a391c26e2e2b..fb229ad985d1330173d2bb620bd36bed8ce189eb 100644 |
--- a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp |
+++ b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp |
@@ -21,6 +21,24 @@ std::unique_ptr<ImageDecoder> createDecoder() { |
} |
} |
+TEST(ICOImageDecoderTests, trunctedIco) { |
+ RefPtr<SharedBuffer> data = |
+ readFile("/LayoutTests/images/resources/png-in-ico.ico"); |
+ ASSERT_FALSE(data->isEmpty()); |
+ |
+ RefPtr<SharedBuffer> truncatedData = |
+ SharedBuffer::create(data->data(), data->size() / 2); |
+ auto decoder = createDecoder(); |
+ |
+ decoder->setData(truncatedData.get(), false); |
+ decoder->frameBufferAtIndex(0); |
+ EXPECT_FALSE(decoder->failed()); |
+ |
+ decoder->setData(truncatedData.get(), true); |
+ decoder->frameBufferAtIndex(0); |
+ EXPECT_TRUE(decoder->failed()); |
+} |
+ |
TEST(ICOImageDecoderTests, errorInPngInIco) { |
RefPtr<SharedBuffer> data = |
readFile("/LayoutTests/images/resources/png-in-ico.ico"); |