Blame SOURCES/cups-filters-CVE-2013-6475.patch

e3af14
diff -up cups-filters-1.0.35/filter/pdftoopvp/oprs/OPVPSplash.cxx.CVE-2013-6475 cups-filters-1.0.35/filter/pdftoopvp/oprs/OPVPSplash.cxx
e3af14
--- cups-filters-1.0.35/filter/pdftoopvp/oprs/OPVPSplash.cxx.CVE-2013-6475	2014-01-20 13:32:28.906801955 +0000
e3af14
+++ cups-filters-1.0.35/filter/pdftoopvp/oprs/OPVPSplash.cxx	2014-01-20 13:34:03.581403757 +0000
e3af14
@@ -1094,7 +1094,7 @@ void OPVPSplash::fillGlyph(SplashCoord x
e3af14
     
e3af14
     opvpbytes = (m+3)/4;
e3af14
     opvpbytes *= 4;
e3af14
-    bp = (Guchar *)gmalloc(opvpbytes*glyph->h);
e3af14
+    bp = (Guchar *)gmallocn(opvpbytes, glyph->h);
e3af14
     for (i = 0;i < glyph->h;i++) {
e3af14
       memcpy(bp+i*opvpbytes,glyph->data+i*m,m);
e3af14
     }
e3af14
@@ -1238,8 +1238,8 @@ SplashError OPVPSplash::fillImageMaskFas
e3af14
   /* align 4 */
e3af14
   opvpbytes = (opvpbytes+3)/4;
e3af14
   opvpbytes *= 4;
e3af14
-  buf = (Guchar *)gmalloc(opvpbytes*h);
e3af14
-  lineBuf = (SplashColorPtr)gmalloc(opvpbytes*8);
e3af14
+  buf = (Guchar *)gmallocn(opvpbytes, h);
e3af14
+  lineBuf = (SplashColorPtr)gmallocn(opvpbytes, 8);
e3af14
 
e3af14
   for (i = 0;i < h;i++) {
e3af14
     int k;
e3af14
@@ -1417,7 +1417,7 @@ SplashError OPVPSplash::fillImageMask(Sp
e3af14
   imat[3] = mat[0]/det;
e3af14
 
e3af14
   /* read source image */
e3af14
-  pixBuf = (SplashColorPtr)gmalloc(h * w);
e3af14
+  pixBuf = (SplashColorPtr)gmallocn(h, w);
e3af14
 
e3af14
   p = pixBuf;
e3af14
   for (i = 0; i < h; ++i) {
e3af14
@@ -1571,7 +1571,7 @@ SplashError OPVPSplash::drawImageNotShea
e3af14
     hs = h-1;
e3af14
     he = -1;
e3af14
   }
e3af14
-  buf = (Guchar *)gmalloc(opvpbytes*h);
e3af14
+  buf = (Guchar *)gmallocn(opvpbytes, h);
e3af14
   lineBuf = (SplashColorPtr)gmalloc(lineBufSize);
e3af14
   switch (colorMode) {
e3af14
   case splashModeMono1:
e3af14
@@ -1734,7 +1734,7 @@ SplashError OPVPSplash::drawImageFastWit
e3af14
     return splashErrOPVP;
e3af14
     break;
e3af14
   }
e3af14
-  buf = (Guchar *)gmalloc(opvpbytes*h);
e3af14
+  buf = (Guchar *)gmallocn(opvpbytes, h);
e3af14
 
e3af14
   switch (colorMode) {
e3af14
   case splashModeMono1:
e3af14
@@ -1960,7 +1960,7 @@ SplashError OPVPSplash::drawImage(Splash
e3af14
   }
e3af14
 
e3af14
   /* read source image */
e3af14
-  pixBuf = (SplashColorPtr)gmalloc(h * linesize);
e3af14
+  pixBuf = (SplashColorPtr)gmallocn(h, linesize);
e3af14
 
e3af14
   p = pixBuf;
e3af14
   for (i = 0; i < h; ++i) {
e3af14
diff -up cups-filters-1.0.35/filter/pdftoopvp/OPVPOutputDev.cxx.CVE-2013-6475 cups-filters-1.0.35/filter/pdftoopvp/OPVPOutputDev.cxx
e3af14
--- cups-filters-1.0.35/filter/pdftoopvp/OPVPOutputDev.cxx.CVE-2013-6475	2014-01-20 13:34:26.782551214 +0000
e3af14
+++ cups-filters-1.0.35/filter/pdftoopvp/OPVPOutputDev.cxx	2014-01-20 13:37:30.670719614 +0000
e3af14
@@ -147,9 +147,9 @@ T3FontCache::T3FontCache(Ref *fontIDA, d
e3af14
   } else {
e3af14
     cacheSets = 1;
e3af14
   }
e3af14
-  cacheData = (Guchar *)gmalloc(cacheSets * cacheAssoc * glyphSize);
e3af14
-  cacheTags = (T3FontCacheTag *)gmalloc(cacheSets * cacheAssoc *
e3af14
-					sizeof(T3FontCacheTag));
e3af14
+  cacheData = (Guchar *)gmallocn3(cacheSets, cacheAssoc, glyphSize);
e3af14
+  cacheTags = (T3FontCacheTag *)gmallocn3(cacheSets, cacheAssoc,
e3af14
+					  sizeof(T3FontCacheTag));
e3af14
   for (i = 0; i < cacheSets * cacheAssoc; ++i) {
e3af14
     cacheTags[i].mru = i & (cacheAssoc - 1);
e3af14
   }
e3af14
@@ -1424,7 +1424,7 @@ void OPVPOutputDev::drawImage(GfxState *
e3af14
       }
e3af14
       break;
e3af14
     case splashModeRGB8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(3, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getRGB(&pix, &rgb);
e3af14
@@ -1434,7 +1434,7 @@ void OPVPOutputDev::drawImage(GfxState *
e3af14
       }
e3af14
       break;
e3af14
     case splashModeBGR8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(3, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getRGB(&pix, &rgb);
e3af14
@@ -1445,7 +1445,7 @@ void OPVPOutputDev::drawImage(GfxState *
e3af14
       break;
e3af14
 #if SPLASH_CMYK
e3af14
     case splashModeCMYK8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(4, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getCMYK(&pix, &cmyk);
e3af14
@@ -1680,7 +1680,7 @@ void OPVPOutputDev::drawMaskedImage(GfxS
e3af14
       }
e3af14
       break;
e3af14
     case splashModeRGB8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(3, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getRGB(&pix, &rgb);
e3af14
@@ -1690,7 +1690,7 @@ void OPVPOutputDev::drawMaskedImage(GfxS
e3af14
       }
e3af14
       break;
e3af14
     case splashModeBGR8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(3, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getRGB(&pix, &rgb);
e3af14
@@ -1701,7 +1701,7 @@ void OPVPOutputDev::drawMaskedImage(GfxS
e3af14
       break;
e3af14
 #if SPLASH_CMYK
e3af14
     case splashModeCMYK8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(4, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getCMYK(&pix, &cmyk);
e3af14
@@ -1847,7 +1847,7 @@ void OPVPOutputDev::drawSoftMaskedImage(
e3af14
       }
e3af14
       break;
e3af14
     case splashModeRGB8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(3, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getRGB(&pix, &rgb);
e3af14
@@ -1857,7 +1857,7 @@ void OPVPOutputDev::drawSoftMaskedImage(
e3af14
       }
e3af14
       break;
e3af14
     case splashModeBGR8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(3, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getRGB(&pix, &rgb);
e3af14
@@ -1868,7 +1868,7 @@ void OPVPOutputDev::drawSoftMaskedImage(
e3af14
       break;
e3af14
 #if SPLASH_CMYK
e3af14
     case splashModeCMYK8:
e3af14
-      imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
e3af14
+      imgData.lookup = (SplashColorPtr)gmallocn(4, n);
e3af14
       for (i = 0; i < n; ++i) {
e3af14
 	pix = (Guchar)i;
e3af14
 	colorMap->getCMYK(&pix, &cmyk);