[poppler] poppler/Gfx.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed May 20 14:21:03 PDT 2009


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

New commits:
commit 95246d39c1289111a4ba3eb2ffbec50d7702e5eb
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed May 20 23:20:20 2009 +0200

    Check Mask entries are int before using them, also if they are real cast to int and try to use them
    
    Fixes bug #21841

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 897b24b..72b1068 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -3823,7 +3823,16 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
 	   i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps;
 	   ++i) {
 	maskObj.arrayGet(i, &obj1);
-	maskColors[i] = obj1.getInt();
+	if (obj1.isInt()) {
+	  maskColors[i] = obj1.getInt();
+	} else if (obj1.isReal()) {
+	  error(-1, "Mask entry should be an integer but it's a real, trying to use it");
+	  maskColors[i] = obj1.getReal();
+	} else {
+	  error(-1, "Mask entry should be an integer but it's of type %d", obj1.getType());
+	  obj1.free();
+	  goto err1;
+	}
 	obj1.free();
       }
       haveColorKeyMask = gTrue;


More information about the poppler mailing list