[poppler] Branch 'poppler-0.8' - 2 commits - poppler/Annot.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon May 26 14:42:50 PDT 2008


 poppler/Annot.cc |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 6b9dd84db02bd162aa3c01d453ddc93a657017bb
Author: Pino Toscano <pino at kde.org>
Date:   Sat Apr 5 03:23:00 2008 +0200

    finally, load the QuadPoints correctly
    
    when checking the validity of the coordinate, do the comparison just with the proper one (either X or Y);
    free the "point" object after each iteration

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index ad68dda..e8b5d77 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -190,12 +190,17 @@ AnnotQuadrilaterals::AnnotQuadrilaterals(Array *array, PDFRectangle *rect) {
         Object obj;
         if (array->get(i * 8 + j, &obj)->isNum()) {
           quadArray[j] = obj.getNum();
-          if (quadArray[j] < rect->x1 || quadArray[j] > rect->x2 ||
-              quadArray[j] < rect->y1 || quadArray[j] < rect->y2)
-            correct = gFalse;
+          if (j % 2 == 1) {
+              if (quadArray[j] < rect->y1 || quadArray[j] > rect->y2)
+                  correct = gFalse;
+          } else {
+              if (quadArray[j] < rect->x1 || quadArray[j] > rect->x2)
+                  correct = gFalse;
+          }
         } else {
             correct = gFalse;
         }
+        obj.free();
       }
 
       if (correct)
commit 7924625e620b5e75b27d7ab935c9aae6ebf02663
Author: Pino Toscano <pino at kde.org>
Date:   Sat Apr 5 02:54:00 2008 +0200

    More robust reading of QuadPoints (reset the allocated memory, use the heap)

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 671af0a..ad68dda 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -30,6 +30,7 @@
 #include "Page.h"
 #include "XRef.h"
 #include "Movie.h"
+#include <string.h>
 
 #define annotFlagHidden    0x0002
 #define annotFlagPrint     0x0004
@@ -170,7 +171,7 @@ AnnotQuadrilaterals::AnnotQuadrilaterals(Array *array, PDFRectangle *rect) {
   GBool correct = gTrue;
   int quadsLength = 0;
   AnnotQuadrilateral **quads;
-  double *quadArray;
+  double quadArray[8];
 
   // default values
   quadrilaterals = NULL;
@@ -182,7 +183,7 @@ AnnotQuadrilaterals::AnnotQuadrilaterals(Array *array, PDFRectangle *rect) {
     quadsLength = arrayLength / 8;
     quads = (AnnotQuadrilateral **) gmallocn
         ((quadsLength), sizeof(AnnotQuadrilateral *));
-    quadArray = (double *) gmallocn (8, sizeof(double));
+    memset(quads, 0, quadsLength * sizeof(AnnotQuadrilateral *));
 
     while (i < (quadsLength) && correct) {
       for (int j = 0; j < 8 && correct; j++) {
@@ -205,8 +206,6 @@ AnnotQuadrilaterals::AnnotQuadrilaterals(Array *array, PDFRectangle *rect) {
       i++;
     }
 
-    gfree (quadArray);
-
     if (correct) {
       quadrilateralsLength = quadsLength;
       quadrilaterals = quads;


More information about the poppler mailing list