Relax the /Pages dictionary /Count check for corrupt documents (issue 9105)
After PR 14311, and follow-up patches, we no longer require that the /Count entry (in the /Pages dictionary) is either present or even valid in order to parse/render a PDF document. Hence it seems strange to keep this requirement for *corrupt* PDF documents, when trying to find a usable `trailer` in the `XRef.indexObjects` method.
This commit is contained in:
parent
782d098baf
commit
bc13a277ce
@ -591,10 +591,6 @@ class XRef {
|
|||||||
if (!(pagesDict instanceof Dict)) {
|
if (!(pagesDict instanceof Dict)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const pagesCount = pagesDict.get("Count");
|
|
||||||
if (!Number.isInteger(pagesCount)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// The top-level /Pages dictionary isn't obviously corrupt.
|
// The top-level /Pages dictionary isn't obviously corrupt.
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
trailerError = ex;
|
trailerError = ex;
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -94,6 +94,7 @@
|
|||||||
!issue9084.pdf
|
!issue9084.pdf
|
||||||
!issue12963.pdf
|
!issue12963.pdf
|
||||||
!issue9105_reduced.pdf
|
!issue9105_reduced.pdf
|
||||||
|
!issue9105_other.pdf
|
||||||
!issue9252.pdf
|
!issue9252.pdf
|
||||||
!issue9262_reduced.pdf
|
!issue9262_reduced.pdf
|
||||||
!issue9291.pdf
|
!issue9291.pdf
|
||||||
|
14
test/pdfs/issue9105_other.pdf
Normal file
14
test/pdfs/issue9105_other.pdf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
%PDF-1.
|
||||||
|
1 0 obj
|
||||||
|
<</Kids[<</Parent 1 0 R/Contents[2 0 R]>>]/Resources<<>>>>
|
||||||
|
2 0 obj
|
||||||
|
<<>>
|
||||||
|
stream
|
||||||
|
BT
|
||||||
|
/F1 105 Tf
|
||||||
|
0 400 Td
|
||||||
|
(Adobe tweet) Tj
|
||||||
|
ET
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
trailer<</Root<</Pages 1 0 R>>>>
|
@ -1748,6 +1748,13 @@
|
|||||||
"link": false,
|
"link": false,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue9105_other",
|
||||||
|
"file": "pdfs/issue9105_other.pdf",
|
||||||
|
"md5": "4c8b9c2cceb9c5d621e1d50b3dc38efc",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": false,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue269_1",
|
{ "id": "issue269_1",
|
||||||
"file": "pdfs/issue269_1.pdf",
|
"file": "pdfs/issue269_1.pdf",
|
||||||
"md5": "ab932f697b4d2e2bf700de15a8efea9c",
|
"md5": "ab932f697b4d2e2bf700de15a8efea9c",
|
||||||
|
Loading…
Reference in New Issue
Block a user