summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2018-02-08 23:58:34 (GMT)
committerTim Schumacher <timschumi@gmx.de>2018-04-06 17:01:43 (GMT)
commit6a051ac4549fc183ff97aa37932fc7113595eab8 (patch)
tree6f79f317e32228629ea44415bdcf1af7cfe56955
parentd8aa8a58d04449cb7035f72548b5e9381f109757 (diff)
downloadandroid_frameworks_ex-cm-13.0.zip
android_frameworks_ex-cm-13.0.tar.gz
android_frameworks_ex-cm-13.0.tar.bz2
Add bounds checking for transparency lookupHEADreplicant-6.0-0004-rc2replicant-6.0-0004-rc1cm-13.0
Bug: 71361451 Test: manual test with sample app Change-Id: Icaa626cfc93115fe1cc2f42040b396c2318bb6e4 (cherry picked from commit 53f97a2dd69b5b74e0fae2108ebab9276760aa47)
-rw-r--r--framesequence/jni/FrameSequence_gif.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/framesequence/jni/FrameSequence_gif.cpp b/framesequence/jni/FrameSequence_gif.cpp
index 8f59dba..8d6a43b 100644
--- a/framesequence/jni/FrameSequence_gif.cpp
+++ b/framesequence/jni/FrameSequence_gif.cpp
@@ -120,12 +120,14 @@ FrameSequence_gif::FrameSequence_gif(Stream* stream) :
}
#endif
- if (mGif->SColorMap) {
+ const ColorMapObject* cmap = mGif->SColorMap;
+ if (cmap) {
// calculate bg color
GraphicsControlBlock gcb;
DGifSavedExtensionToGCB(mGif, 0, &gcb);
- if (gcb.TransparentColor == NO_TRANSPARENT_COLOR) {
- mBgColor = gifColorToColor8888(mGif->SColorMap->Colors[mGif->SBackGroundColor]);
+ if (gcb.TransparentColor == NO_TRANSPARENT_COLOR
+ && mGif->SBackGroundColor < cmap->ColorCount) {
+ mBgColor = gifColorToColor8888(cmap->Colors[mGif->SBackGroundColor]);
}
}
}
@@ -367,4 +369,3 @@ static RegistryEntry gEntry = {
acceptsBuffers,
};
static Registry gRegister(gEntry);
-