Always use a color table with 256 colors
Speculative fix for skbug.com/5883 We are hitting an assert (which I have not been able to repro - still need to get the skp that triggers it) because we are trying to read beyond the end of the color table. We use 8-bit indices, so 256 should be enough to prevent going beyond the end. There is only one case when we use a smaller color table - when it is a dummy. Make the dummy full size. NOTREECHECKS=true BUG=skia:5883 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2452673002 Review-Url: https://codereview.chromium.org/2452673002
This commit is contained in:
parent
e9db0b7f0e
commit
0057ac11fc
@ -37,6 +37,7 @@
|
||||
#include "SkGifCodec.h"
|
||||
#include "SkStream.h"
|
||||
#include "SkSwizzler.h"
|
||||
#include "SkUtils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -143,9 +144,10 @@ void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIn
|
||||
fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex);
|
||||
fCurrColorTableIsReal = fCurrColorTable;
|
||||
if (!fCurrColorTable) {
|
||||
// This is possible for an empty frame. Create a dummy with one value (transparent).
|
||||
SkPMColor color = SK_ColorTRANSPARENT;
|
||||
fCurrColorTable.reset(new SkColorTable(&color, 1));
|
||||
// This is possible for an empty frame. Create a dummy with all transparent.
|
||||
SkPMColor colors[MAX_COLORS];
|
||||
sk_memset32(colors, SK_ColorTRANSPARENT, MAX_COLORS);
|
||||
fCurrColorTable.reset(new SkColorTable(colors, 256));
|
||||
}
|
||||
|
||||
if (inputColorCount) {
|
||||
|
Loading…
Reference in New Issue
Block a user