Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp

Issue 2761303003: Make ICO fail on truncated data (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698