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

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


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

New commits:
commit eeecd9718f201dc795b2cb8469c43860aec6e07d
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 b15ee5f..775a2c9 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4135,10 +4135,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 e7e9ab8..aa81e56 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -227,6 +227,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 43d66e11aa9e692c1c6b3a237e7e972d317e5c4d
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 8d0ffea..1130d8d 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -1796,7 +1796,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);
@@ -1833,7 +1833,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