aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-04-12 17:01:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-17 16:35:35 +0000
commit7d22a33e219ba8038821b378ab80ed9028723d49 (patch)
treecc8ee51ffb392f579ffa04087c5a2a024934510c
parent0cf45f607cfc5d22ef9e6fbe0c7480a409349704 (diff)
Add a test for getFrameInfo on truncated data
Prior to e132e7be5f9108692254c37db592ea7611abbc15, calling getFrameInfo on an SkGifCodec which was truncated before fully parsing the local color map of the first frame would hit an assert. Add a test to verify that the problem has been fixed. Modify box.gif to use a local color map for the first (and only) frame. Change-Id: I905afe60c0c6ecc82e251e00ef82b2e5b22975a3 Reviewed-on: https://skia-review.googlesource.com/13320 Reviewed-by: Chris Blume <cblume@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
-rw-r--r--resources/box.gifbin472 -> 472 bytes
-rw-r--r--tests/CodecAnimTest.cpp7
2 files changed, 7 insertions, 0 deletions
diff --git a/resources/box.gif b/resources/box.gif
index bcf81863b7..72884ce484 100644
--- a/resources/box.gif
+++ b/resources/box.gif
Binary files differ
diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp
index 02253ef64f..3d7080e35d 100644
--- a/tests/CodecAnimTest.cpp
+++ b/tests/CodecAnimTest.cpp
@@ -31,6 +31,13 @@ static void write_bm(const char* name, const SkBitmap& bm) {
}
}
+DEF_TEST(Codec_trunc, r) {
+ sk_sp<SkData> data(GetResourceAsData("box.gif"));
+ data = SkData::MakeSubset(data.get(), 0, 23);
+ std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(data));
+ codec->getFrameInfo();
+}
+
DEF_TEST(Codec_frames, r) {
#define kOpaque kOpaque_SkAlphaType
#define kUnpremul kUnpremul_SkAlphaType