poppler/XRef.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
New commits: commit 4f478daa6a9734b8f269a6586bdce2909844bb6f Author: Albert Astals Cid <[email protected]> Date: Wed Dec 23 23:52:58 2020 +0100 Fix opening files by some generators that are a bit broken But Adobe opens it and it's easy to fix diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 66d3f04a..c36c747a 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -45,6 +45,7 @@ #include <cctype> #include <climits> #include <cfloat> +#include <limits> #include "goo/gfile.h" #include "goo/gmem.h" #include "Object.h" @@ -793,8 +794,13 @@ bool XRef::readXRefStreamSection(Stream *xrefStr, const int *w, int first, int n gen = (gen << 8) + c; } if (gen > INT_MAX) { - error(errSyntaxError, -1, "Gen inside xref table too large (bigger than INT_MAX)"); - return false; + if (i == 0 && gen == std::numeric_limits<uint32_t>::max()) { + // workaround broken generators + gen = 65535; + } else { + error(errSyntaxError, -1, "Gen inside xref table too large (bigger than INT_MAX)"); + return false; + } } if (entries[i].offset == -1) { switch (type) { _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
