[poppler] 2 commits - poppler/GfxState.cc poppler/Parser.cc poppler/SplashOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Dec 27 06:32:53 PST 2009


 poppler/GfxState.cc        |   21 ---------------------
 poppler/Parser.cc          |    3 ++-
 poppler/SplashOutputDev.cc |   15 +++++++++++++++
 3 files changed, 17 insertions(+), 22 deletions(-)

New commits:
commit 3b6e3605209d5db453725b9ce4e6e54679d9c5da
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Dec 27 15:30:22 2009 +0100

    Do not crop the transformation matrix at an arbitrary value
    
    Fixes bug 25763 and gave no regression on my test suite

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 0dc02b4..36eeaaf 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -4780,23 +4780,12 @@ void GfxState::getFontTransMat(double *m11, double *m12,
 
 void GfxState::setCTM(double a, double b, double c,
 		      double d, double e, double f) {
-  int i;
-
   ctm[0] = a;
   ctm[1] = b;
   ctm[2] = c;
   ctm[3] = d;
   ctm[4] = e;
   ctm[5] = f;
-
-  // avoid FP exceptions on badly messed up PDF files
-  for (i = 0; i < 6; ++i) {
-    if (ctm[i] > 1e10) {
-      ctm[i] = 1e10;
-    } else if (ctm[i] < -1e10) {
-      ctm[i] = -1e10;
-    }
-  }
 }
 
 void GfxState::concatCTM(double a, double b, double c,
@@ -4805,7 +4794,6 @@ void GfxState::concatCTM(double a, double b, double c,
   double b1 = ctm[1];
   double c1 = ctm[2];
   double d1 = ctm[3];
-  int i;
 
   ctm[0] = a * a1 + b * c1;
   ctm[1] = a * b1 + b * d1;
@@ -4813,15 +4801,6 @@ void GfxState::concatCTM(double a, double b, double c,
   ctm[3] = c * b1 + d * d1;
   ctm[4] = e * a1 + f * c1 + ctm[4];
   ctm[5] = e * b1 + f * d1 + ctm[5];
-
-  // avoid FP exceptions on badly messed up PDF files
-  for (i = 0; i < 6; ++i) {
-    if (ctm[i] > 1e10) {
-      ctm[i] = 1e10;
-    } else if (ctm[i] < -1e10) {
-      ctm[i] = -1e10;
-    }
-  }
 }
 
 void GfxState::shiftCTM(double tx, double ty) {
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 4d51a42..a26cd09 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1983,6 +1983,9 @@ void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
   }
 
   ctm = state->getCTM();
+  for (int i = 0; i < 6; ++i) {
+    if (!isfinite(ctm[i])) return;
+  }
   mat[0] = ctm[0];
   mat[1] = ctm[1];
   mat[2] = -ctm[2];
@@ -2261,6 +2264,9 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
   int n, i;
 
   ctm = state->getCTM();
+  for (i = 0; i < 6; ++i) {
+    if (!isfinite(ctm[i])) return;
+  }
   mat[0] = ctm[0];
   mat[1] = ctm[1];
   mat[2] = -ctm[2];
@@ -2528,6 +2534,12 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
     //----- draw the source image
 
     ctm = state->getCTM();
+    for (i = 0; i < 6; ++i) {
+      if (!isfinite(ctm[i])) {
+        delete maskBitmap;
+        return;
+      }
+    }
     mat[0] = ctm[0];
     mat[1] = ctm[1];
     mat[2] = -ctm[2];
@@ -2639,6 +2651,9 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
   int n, i;
 
   ctm = state->getCTM();
+  for (i = 0; i < 6; ++i) {
+    if (!isfinite(ctm[i])) return;
+  }
   mat[0] = ctm[0];
   mat[1] = ctm[1];
   mat[2] = -ctm[2];
commit ea44c60645001ffea7d297f8549aaa4f5ce5e16c
Author: Ilya Gorenbein <igorenbein at finjan.com>
Date:   Sun Dec 27 15:27:00 2009 +0100

    Try to work on streams without Length
    
    We have code that finds the Length if it's wrong so let that code do its job
    instead of returning a NULL stream

diff --git a/poppler/Parser.cc b/poppler/Parser.cc
index 05fba86..5f8e15d 100644
--- a/poppler/Parser.cc
+++ b/poppler/Parser.cc
@@ -15,6 +15,7 @@
 //
 // Copyright (C) 2006, 2009 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
+// Copyright (C) 2009 Ilya Gorenbein <igorenbein at finjan.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -179,7 +180,7 @@ Stream *Parser::makeStream(Object *dict, Guchar *fileKey,
   } else {
     error(getPos(), "Bad 'Length' attribute in stream");
     obj.free();
-    return NULL;
+    length = 0;
   }
 
   // check for length in damaged file


More information about the poppler mailing list