[poppler] poppler/Form.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 15 22:08:57 UTC 2020


 poppler/Form.cc |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit eb7940e737633c17696aec78ecad92048d6163e5
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Sep 16 00:04:01 2020 +0200

    Filter out repeated forms
    
    Some files like the one from KDE bug 426467 has the same signature
    repeated 23 times in the Fields field, just return it one

diff --git a/poppler/Form.cc b/poppler/Form.cc
index b7ffc196..2ea343dd 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -2005,6 +2005,7 @@ Form::Form(PDFDoc *docA, Object *acroFormA)
     obj1 = acroForm->dictLookup("Fields");
     if (obj1.isArray()) {
         Array *array = obj1.getArray();
+        std::set<Ref> alreadyReadRefs;
         for (int i = 0; i < array->getLength(); i++) {
             Object obj2 = array->get(i);
             const Object &oref = array->getNF(i);
@@ -2018,6 +2019,11 @@ Form::Form(PDFDoc *docA, Object *acroFormA)
                 continue;
             }
 
+            if (alreadyReadRefs.find(oref.getRef()) != alreadyReadRefs.end()) {
+                continue;
+            }
+            alreadyReadRefs.insert(oref.getRef());
+
             if (numFields >= size) {
                 size += 16;
                 rootFields = (FormField **)greallocn(rootFields, size, sizeof(FormField *));


More information about the poppler mailing list