Make XRef_indexObjects
even more robust against bad PDF files, by checking for the existence of 'trailer' if 'xref' is not found
Fixes http://www.cyjack.com/cognition/Terence%20McKenna%20-%20Lectures%20on%20Alchemy.pdf.
This commit is contained in:
parent
1bdfc47de8
commit
192907e0d2
@ -1118,6 +1118,10 @@ var XRef = (function XRefClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
position += contentLength;
|
position += contentLength;
|
||||||
|
} else if (token.indexOf('trailer') === 0 &&
|
||||||
|
(token.length === 7 || /\s/.test(token[7]))) {
|
||||||
|
trailers.push(position);
|
||||||
|
position += skipUntil(buffer, position, startxrefBytes);
|
||||||
} else {
|
} else {
|
||||||
position += token.length + 1;
|
position += token.length + 1;
|
||||||
}
|
}
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -4,6 +4,7 @@
|
|||||||
!tracemonkey.pdf
|
!tracemonkey.pdf
|
||||||
!franz.pdf
|
!franz.pdf
|
||||||
!franz_2.pdf
|
!franz_2.pdf
|
||||||
|
!xref_command_missing.pdf
|
||||||
!issue2391-1.pdf
|
!issue2391-1.pdf
|
||||||
!issue2391-2.pdf
|
!issue2391-2.pdf
|
||||||
!issue5801.pdf
|
!issue5801.pdf
|
||||||
|
66
test/pdfs/xref_command_missing.pdf
Normal file
66
test/pdfs/xref_command_missing.pdf
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
%PDF-1.7
|
||||||
|
%âãÏÓ
|
||||||
|
1 0 obj
|
||||||
|
<<
|
||||||
|
/Pages 2 0 R
|
||||||
|
/Type /Catalog
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
2 0 obj
|
||||||
|
<<
|
||||||
|
/Kids [3 0 R]
|
||||||
|
/Type /Pages
|
||||||
|
/Count 1
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
3 0 obj
|
||||||
|
<<
|
||||||
|
/Parent 2 0 R
|
||||||
|
/Resources
|
||||||
|
<<
|
||||||
|
/Font
|
||||||
|
<<
|
||||||
|
/F1 4 0 R
|
||||||
|
>>
|
||||||
|
>>
|
||||||
|
/MediaBox [0 0 200 50]
|
||||||
|
/Type /Page
|
||||||
|
/Contents 5 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
4 0 obj
|
||||||
|
<<
|
||||||
|
/BaseFont /Times-Roman
|
||||||
|
/Subtype /Type1
|
||||||
|
/Type /Font
|
||||||
|
/Encoding /WinAnsiEncoding
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
5 0 obj
|
||||||
|
<<
|
||||||
|
/Length 48
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
BT
|
||||||
|
10 20 TD
|
||||||
|
/F1 20 Tf
|
||||||
|
(Reduced test-case) Tj
|
||||||
|
ET
|
||||||
|
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
0000000000 65535 f
|
||||||
|
0000000015 00000 n
|
||||||
|
0000000066 00000 n
|
||||||
|
0000000125 00000 n
|
||||||
|
0000000254 00000 n
|
||||||
|
0000000355 00000 n
|
||||||
|
trailer
|
||||||
|
|
||||||
|
<<
|
||||||
|
/Root 1 0 R
|
||||||
|
/Size 6
|
||||||
|
>>
|
||||||
|
startxref
|
||||||
|
455
|
||||||
|
%%EOF
|
@ -572,6 +572,13 @@
|
|||||||
"link": false,
|
"link": false,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "xref_command_missing",
|
||||||
|
"file": "pdfs/xref_command_missing.pdf",
|
||||||
|
"md5": "06cdb0f13cfeff41d6bfb24b7bbe1268",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": false,
|
||||||
|
"type": "load"
|
||||||
|
},
|
||||||
{ "id": "issue5501",
|
{ "id": "issue5501",
|
||||||
"file": "pdfs/issue5501.pdf",
|
"file": "pdfs/issue5501.pdf",
|
||||||
"md5": "55a60699728fc92f491a2d7d490474e4",
|
"md5": "55a60699728fc92f491a2d7d490474e4",
|
||||||
|
Loading…
Reference in New Issue
Block a user