double x[gfxColorMaxComps];
double y[gfxColorMaxComps];
int i, j, k;
+ int maxPixelForAlloc;
ok = gTrue;
// bits per component and color space
bits = bitsA;
maxPixel = (1 << bits) - 1;
+ maxPixelForAlloc = (1 << (bits>8?bits:8));
colorSpace = colorSpaceA;
// get decode map
colorSpace2 = indexedCS->getBase();
indexHigh = indexedCS->getIndexHigh();
nComps2 = colorSpace2->getNComps();
- lookup = (double *)gmalloc((maxPixel + 1) * nComps2 * sizeof(double));
+ lookup = (double *)gmalloc((maxPixelForAlloc + 1) * nComps2 * sizeof(double));
lookup2 = indexedCS->getLookup();
colorSpace2->getDefaultRanges(x, y, indexHigh);
for (i = 0; i <= maxPixel; ++i) {
sepCS = (GfxSeparationColorSpace *)colorSpace;
colorSpace2 = sepCS->getAlt();
nComps2 = colorSpace2->getNComps();
- lookup = (double *)gmalloc((maxPixel + 1) * nComps2 * sizeof(double));
+ lookup = (double *)gmalloc((maxPixelForAlloc + 1) * nComps2 * sizeof(double));
sepFunc = sepCS->getFunc();
for (i = 0; i <= maxPixel; ++i) {
x[0] = decodeLow[0] + (i * decodeRange[0]) / maxPixel;
}
}
} else {
- lookup = (double *)gmalloc((maxPixel + 1) * nComps * sizeof(double));
+ lookup = (double *)gmalloc((maxPixelForAlloc + 1) * nComps * sizeof(double));
for (i = 0; i <= maxPixel; ++i) {
for (k = 0; k < nComps; ++k) {
lookup[i*nComps + k] = decodeLow[k] +