summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2014-03-28 20:49:17 +1030
committerAdrian Johnson <ajohnson@redneon.com>2014-03-31 06:34:28 +1030
commit38dcaf96f308265ff6958e4683bcec2be0c254b9 (patch)
tree543f6ed36ee3426ee19423fecf929ac9a4b20ab5
parent07b0a038b194eb0392a1e9a4236064d37247d687 (diff)
cairo: fix segv cause by bad image stream
bug 76445
-rw-r--r--poppler/CairoOutputDev.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 77bd2458..4924f4bd 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;