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

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: commens 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
« no previous file with comments | « no previous file | Source/platform/image-decoders/gif/GIFImageReader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
Stephen White 2015/01/14 22:17:02 Not new to this CL, but we should probably shorten
Alpha Left Google 2015/01/14 23:14:59 Done.
+ 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());
+ }
+}
« no previous file with comments | « no previous file | Source/platform/image-decoders/gif/GIFImageReader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698