Hi!
Here is a patch I made (against 0.56.0) to cope with a broken pdf that
caused a crash.  I hope it is equally useful for others.

Regards, Jan-Erik

diff -aur opoppler-0.56.0/poppler/StructTreeRoot.cc poppler-0.56.0/poppler/StructTreeRoot.cc
--- opoppler-0.56.0/poppler/StructTreeRoot.cc	2017-06-17 18:35:25.000000000 +0200
+++ poppler-0.56.0/poppler/StructTreeRoot.cc	2017-06-29 09:24:48.112333456 +0200
@@ -67,13 +67,13 @@
             index.free();
             continue;
           }
-          if (index.getInt() < 0) {
-            error(errSyntaxError, -1, "Nums item at position {0:d} is invalid value ({1:d})", i, index.getInt());
+          const unsigned idx = index.getInt();
+          if (index.getInt() < 0 || idx >= parentTree.size()) {
+            error(errSyntaxError, -1, "Nums item at position {0:d} is invalid value ({1:d}): [0..{2:d}]", i, index.getInt(), parentTree.size() - 1);
             index.free();
             continue;
           }
 
-          const unsigned idx = index.getInt();
           if (nums.arrayGetNF(i + 1, &value)->isRef()) {
             parentTree[idx].resize(1);
             parentTree[idx][0].ref = value.getRef();
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to