Blame SOURCES/poppler-20.11.0-bad-generation.patch
|
|
a95c8b |
From 4f478daa6a9734b8f269a6586bdce2909844bb6f Mon Sep 17 00:00:00 2001
|
|
|
a95c8b |
From: Albert Astals Cid <aacid@kde.org>
|
|
|
a95c8b |
Date: Wed, 23 Dec 2020 23:52:58 +0100
|
|
|
a95c8b |
Subject: Fix opening files by some generators that are a bit broken
|
|
|
a95c8b |
|
|
|
a95c8b |
But Adobe opens it and it's easy to fix
|
|
|
a95c8b |
|
|
|
a95c8b |
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
|
|
|
a95c8b |
index 66d3f04a..c36c747a 100644
|
|
|
a95c8b |
--- a/poppler/XRef.cc
|
|
|
a95c8b |
+++ b/poppler/XRef.cc
|
|
|
a95c8b |
@@ -45,6 +45,7 @@
|
|
|
a95c8b |
#include <cctype>
|
|
|
a95c8b |
#include <climits>
|
|
|
a95c8b |
#include <cfloat>
|
|
|
a95c8b |
+#include <limits>
|
|
|
a95c8b |
#include "goo/gfile.h"
|
|
|
a95c8b |
#include "goo/gmem.h"
|
|
|
a95c8b |
#include "Object.h"
|
|
|
a95c8b |
@@ -793,8 +794,13 @@ bool XRef::readXRefStreamSection(Stream *xrefStr, const int *w, int first, int n
|
|
|
a95c8b |
gen = (gen << 8) + c;
|
|
|
a95c8b |
}
|
|
|
a95c8b |
if (gen > INT_MAX) {
|
|
|
a95c8b |
- error(errSyntaxError, -1, "Gen inside xref table too large (bigger than INT_MAX)");
|
|
|
a95c8b |
- return false;
|
|
|
a95c8b |
+ if (i == 0 && gen == std::numeric_limits<uint32_t>::max()) {
|
|
|
a95c8b |
+ // workaround broken generators
|
|
|
a95c8b |
+ gen = 65535;
|
|
|
a95c8b |
+ } else {
|
|
|
a95c8b |
+ error(errSyntaxError, -1, "Gen inside xref table too large (bigger than INT_MAX)");
|
|
|
a95c8b |
+ return false;
|
|
|
a95c8b |
+ }
|
|
|
a95c8b |
}
|
|
|
a95c8b |
if (entries[i].offset == -1) {
|
|
|
a95c8b |
switch (type) {
|