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

Unified Diff: Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp

Issue 813943003: Fix handling of broken GIFs with weird frame sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: comments Created 5 years, 11 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
Index: Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
diff --git a/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
index db39a29bfc4c3c35fdb767c8285ea3a882eae7cd..ae2f2c89cf33364af0d52aadb95de116eb8806e6 100644
--- a/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
+++ b/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
@@ -499,3 +499,27 @@ TEST(GIFImageDecoderTest, invalidDisposalMethod)
// Disposal method 5 is ignored.
EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->disposalMethod());
}
+
+TEST(GIFImageDecoderTest, firstFrameHasGreaterSizeThanScreenSize)
+{
+ RefPtr<SharedBuffer> fullData = readFile("/Source/platform/image-decoders/testing/first-frame-has-greater-size-than-screen-size.gif");
+ ASSERT_TRUE(fullData.get());
+
+ OwnPtr<GIFImageDecoder> decoder;
+ IntSize frameSize;
+
+ // Compute hashes when the file is truncated.
+ for (size_t i = 1; i <= fullData->size(); ++i) {
+ decoder = createDecoder();
+ RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), i);
+ decoder->setData(data.get(), i == fullData->size());
+
+ if (decoder->isSizeAvailable() && !frameSize.width() && !frameSize.height()) {
+ frameSize = decoder->decodedSize();
+ continue;
+ }
+
+ ASSERT_EQ(frameSize.width(), decoder->decodedSize().width());
+ ASSERT_EQ(frameSize.height(), decoder->decodedSize().height());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698