fixed windows access violation which occurs if one tries to retrieve
authorkramm <kramm>
Thu, 5 Aug 2004 19:39:20 +0000 (19:39 +0000)
committerkramm <kramm>
Thu, 5 Aug 2004 19:39:20 +0000 (19:39 +0000)
all 256 palette entries on an optimized palette.

pdf2swf/xpdf/GfxState.cc

index 1668c24..a6018be 100644 (file)
@@ -1664,7 +1664,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
     colorSpace2 = indexedCS->getBase();
     indexHigh = indexedCS->getIndexHigh();
     nComps2 = colorSpace2->getNComps();
-    lookup = (double *)gmalloc((indexHigh + 1) * nComps2 * sizeof(double));
+    lookup = (double *)gmalloc((maxPixel + 1) * nComps2 * sizeof(double));
     lookup2 = indexedCS->getLookup();
     for (i = 0; i <= indexHigh; ++i) {
       j = (int)(decodeLow[0] +(i * decodeRange[0]) / maxPixel + 0.5);
@@ -1728,6 +1728,7 @@ void GfxImageColorMap::getGray(Guchar *x, double *gray) {
 }
 
 void GfxImageColorMap::getRGB(Guchar *x, GfxRGB *rgb) {
+
   GfxColor color;
   double *p;
   int i;