[poppler] poppler/CairoOutputDev.cc

Adrian Johnson ajohnson at kemper.freedesktop.org
Sun Mar 30 13:07:59 PDT 2014


 poppler/CairoOutputDev.cc |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 38dcaf96f308265ff6958e4683bcec2be0c254b9
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Mar 28 20:49:17 2014 +1030

    cairo: fix segv cause by bad image stream
    
    bug 76445

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 77bd245..4924f4b 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -2731,6 +2731,7 @@ private:
   GfxImageColorMap *colorMap;
   int *maskColors;
   int current_row;
+  GBool imageError;
 
 public:
   cairo_surface_t *getSourceImage(Stream *str,
@@ -2747,6 +2748,7 @@ public:
     maskColors = maskColorsA;
     width = widthA;
     current_row = -1;
+    imageError = gFalse;
 
     /* TODO: Do we want to cache these? */
     imgStr = new ImageStream(str, width,
@@ -2837,7 +2839,13 @@ public:
       current_row++;
     }
 
-    if (lookup) {
+    if (unlikely(pix == NULL)) {
+      memset(row_data, 0, width*4);
+      if (!imageError) {
+	error(errInternal, -1, "Bad image stream");
+	imageError = gTrue;
+      }
+    } else if (lookup) {
       Guchar *p = pix;
       GfxRGB rgb;
 


More information about the poppler mailing list