Commit 8a845c65 authored by Albert Astals Cid's avatar Albert Astals Cid

Fix crash introduced by c792e4cd

We need to initialize properly the fields that will be used in the
destructor before bailing out
parent e67e88b3
......@@ -5707,13 +5707,21 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
ok = gTrue;
useMatte = gFalse;
colorSpace = colorSpaceA;
// initialize
for (k = 0; k < gfxColorMaxComps; ++k) {
lookup[k] = nullptr;
lookup2[k] = nullptr;
}
byte_lookup = nullptr;
// bits per component and color space
if (unlikely(bitsA <= 0 || bitsA > 30))
goto err1;
bits = bitsA;
maxPixel = (1 << bits) - 1;
colorSpace = colorSpaceA;
// this is a hack to support 16 bits images, everywhere
// we assume a component fits in 8 bits, with this hack
......@@ -5721,13 +5729,6 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
// The hack has another part on ImageStream::getLine
if (maxPixel > 255) maxPixel = 255;
// initialize
for (k = 0; k < gfxColorMaxComps; ++k) {
lookup[k] = nullptr;
lookup2[k] = nullptr;
}
byte_lookup = nullptr;
// get decode map
if (decode->isNull()) {
nComps = colorSpace->getNComps();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment