From 4bfd4bae257bef1693e3585b5e0f3f9d397372aa Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Tue, 18 Oct 2016 10:17:41 -0700 Subject: Handle color bounds correctly in GIF decode. CYNGNOS-3312 Bug: 31631842 Change-Id: Ia4d25d9cd440286366f82433d3ff227384c0572f (cherry picked from commit 0ada9456d0270cb0e357a43d9187a6418d770760) (cherry picked from commit ade3088d82be5ddf9cbe434c2810ed12ef88b723) --- framesequence/jni/FrameSequence_gif.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framesequence/jni/FrameSequence_gif.cpp b/framesequence/jni/FrameSequence_gif.cpp index 2188c53..e658425 100644 --- a/framesequence/jni/FrameSequence_gif.cpp +++ b/framesequence/jni/FrameSequence_gif.cpp @@ -157,7 +157,7 @@ static bool checkIfCover(const GifImageDesc& target, const GifImageDesc& covered static void copyLine(Color8888* dst, const unsigned char* src, const ColorMapObject* cmap, int transparent, int width) { for (; width > 0; width--, src++, dst++) { - if (*src != transparent) { + if (*src != transparent && *src < cmap->ColorCount) { *dst = gifColorToColor8888(cmap->Colors[*src]); } } -- cgit v1.2.3