From 31b3c7564388e05732cb25517ce0b72bf5d04ec2 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 28 Mar 2014 20:49:17 +1030 Subject: [PATCH] cairo: fix segv cause by bad image stream bug 76445 --- poppler/CairoOutputDev.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; -- 1.7.10.4