Commit 22ea442d authored by Albert Astals Cid's avatar Albert Astals Cid

SplashOutputDev::drawImage: gmallocn -> checkoverflow

oss-fuzz/10194

And also add a likely for the previous change in the file
parent 8ff1bddc
Pipeline #4598 passed with stage
in 7 minutes and 32 seconds
......@@ -3553,14 +3553,16 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
}
break;
case splashModeXBGR8:
imgData.lookup = (SplashColorPtr)gmallocn(n, 4);
for (i = 0; i < n; ++i) {
pix = (Guchar)i;
colorMap->getRGB(&pix, &rgb);
imgData.lookup[4*i] = colToByte(rgb.r);
imgData.lookup[4*i+1] = colToByte(rgb.g);
imgData.lookup[4*i+2] = colToByte(rgb.b);
imgData.lookup[4*i+3] = 255;
imgData.lookup = (SplashColorPtr)gmallocn_checkoverflow(n, 4);
if (likely(imgData.lookup != nullptr)) {
for (i = 0; i < n; ++i) {
pix = (Guchar)i;
colorMap->getRGB(&pix, &rgb);
imgData.lookup[4*i] = colToByte(rgb.r);
imgData.lookup[4*i+1] = colToByte(rgb.g);
imgData.lookup[4*i+2] = colToByte(rgb.b);
imgData.lookup[4*i+3] = 255;
}
}
break;
#ifdef SPLASH_CMYK
......@@ -4070,7 +4072,7 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
break;
case splashModeXBGR8:
imgData.lookup = (SplashColorPtr)gmallocn_checkoverflow(n, 4);
if (imgData.lookup) {
if (likely(imgData.lookup != nullptr)) {
for (i = 0; i < n; ++i) {
pix = (Guchar)i;
colorMap->getRGB(&pix, &rgb);
......
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