[poppler] Branch 'poppler-0.22' - 2 commits - poppler/Gfx.cc poppler/Gfx.h utils/HtmlOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Apr 25 11:32:18 PDT 2013


 poppler/Gfx.cc         |   23 +++++++++++++++++++----
 poppler/Gfx.h          |    2 ++
 utils/HtmlOutputDev.cc |    4 ++--
 3 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit ec298b3b780f885464aa00880150eaa2b9b50b08
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Apr 25 20:29:24 2013 +0200

    Do not start drawing a form we are already drawing
    
    Bug #63190

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 7047482..ae103aa 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4133,10 +4133,25 @@ void Gfx::opXObject(Object args[], int numArgs) {
     }
   } else if (obj2.isName("Form")) {
     res->lookupXObjectNF(name, &refObj);
-    if (out->useDrawForm() && refObj.isRef()) {
-      out->drawForm(refObj.getRef());
-    } else {
-      doForm(&obj1);
+    GBool shouldDoForm = gTrue;
+    std::set<int>::iterator drawingFormIt;
+    if (refObj.isRef()) {
+      const int num = refObj.getRef().num;
+      if (formsDrawing.find(num) == formsDrawing.end()) {
+	drawingFormIt = formsDrawing.insert(num).first;
+      } else {
+	shouldDoForm = gFalse;	
+      }
+    }
+    if (shouldDoForm) {
+      if (out->useDrawForm() && refObj.isRef()) {
+	out->drawForm(refObj.getRef());
+      } else {
+	doForm(&obj1);
+      }
+    }
+    if (refObj.isRef() && shouldDoForm) {
+      formsDrawing.erase(drawingFormIt);
     }
     refObj.free();
   } else if (obj2.isName("PS")) {
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 7c42f14..0704597 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -225,6 +225,8 @@ private:
   MarkedContentStack *mcStack;	// current BMC/EMC stack
 
   Parser *parser;		// parser for page content stream(s)
+  
+  std::set<int> formsDrawing;	// the forms that are being drawn
 
 #ifdef USE_CMS
   PopplerCache iccColorSpaceCache;
commit 11ab42e7e90099d0cebf8f02197413fd5dee044b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Apr 25 20:27:43 2013 +0200

    Make sure getKids returns != 0 before using it
    
    Fixes crash in bug #63909

diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index a718380..8fd2dd1 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -1795,7 +1795,7 @@ GBool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, GooList *outlines, Catalo
 		atLeastOne = gTrue;
 
 		item->open();
-		if (item->hasKids())
+		if (item->hasKids() && item->getKids())
 		{
 			fputs("\n",output);
 			newHtmlOutlineLevel(output, item->getKids(), catalog, level+1);
@@ -1832,7 +1832,7 @@ void HtmlOutputDev::newXmlOutlineLevel(FILE *output, GooList *outlines, Catalog*
         delete titleStr;
 
         item->open();
-        if (item->hasKids())
+        if (item->hasKids() && item->getKids())
         {
             newXmlOutlineLevel(output, item->getKids(), catalog);
         }


More information about the poppler mailing list