[poppler] poppler/CairoOutputDev.cc

Adrian Johnson ajohnson at kemper.freedesktop.org
Thu Nov 9 08:13:36 UTC 2017


 poppler/CairoOutputDev.cc |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 7ccedf2b082e4d46257fb247e1f6e1197d66eead
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Nov 8 21:07:45 2017 +1030

    cairo: don't overflow y * stride when accessing image data

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 43c604f0..cc8a161b 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1834,7 +1834,7 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha,
     /* convert to a luminocity map */
     uint32_t *source_data = (uint32_t*)cairo_image_surface_get_data(source);
     /* get stride in units of 32 bits */
-    int stride = cairo_image_surface_get_stride(source)/4;
+    ptrdiff_t stride = cairo_image_surface_get_stride(source)/4;
     for (int y=0; y<height; y++) {
       for (int x=0; x<width; x++) {
 	int lum = alpha ? fill_opacity : luminocity(source_data[y*stride + x]);
@@ -2127,7 +2127,7 @@ void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream *
   Guchar *pix;
   cairo_matrix_t matrix;
   int invert_bit;
-  int row_stride;
+  ptrdiff_t row_stride;
   cairo_filter_t filter;
 
   /* TODO: Do we want to cache these? */
@@ -2234,7 +2234,7 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream
   Guchar *pix;
   cairo_matrix_t matrix;
   int invert_bit;
-  int row_stride;
+  ptrdiff_t row_stride;
 
   /* cairo does a very poor job of scaling down images so we scale them ourselves */
 
@@ -2527,7 +2527,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref,
 				     GBool maskInterpolate)
 {
   ImageStream *maskImgStr, *imgStr;
-  int row_stride;
+  ptrdiff_t row_stride;
   unsigned char *maskBuffer, *buffer;
   unsigned char *maskDest;
   unsigned int *dest;
@@ -2685,7 +2685,7 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s
 					 GBool maskInterpolate)
 {
   ImageStream *maskImgStr, *imgStr;
-  int row_stride;
+  ptrdiff_t row_stride;
   unsigned char *maskBuffer, *buffer;
   unsigned char *maskDest;
   unsigned int *dest;
@@ -3088,7 +3088,7 @@ public:
     if (!needsCustomDownscaling || printing || scaledWidth >= width || scaledHeight >= height) {
       // No downscaling. Create cairo image containing the source image data.
       unsigned char *buffer;
-      int stride;
+      ptrdiff_t stride;
 
       image = cairo_image_surface_create (maskColors ?
                                           CAIRO_FORMAT_ARGB32 :


More information about the poppler mailing list