Merge pull request #10615 from Snuffleupagus/corrupt-inline-ASCII85Decode
Handle corrupt ASCII85Decode inline images with whitespace "inside" of the EOD marker (issue 10614)
This commit is contained in:
commit
8b149b818e
@ -336,14 +336,22 @@ var Parser = (function ParserClosure() {
|
|||||||
* Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream.
|
* Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream.
|
||||||
* @returns {number} The inline stream length.
|
* @returns {number} The inline stream length.
|
||||||
*/
|
*/
|
||||||
findASCII85DecodeInlineStreamEnd:
|
findASCII85DecodeInlineStreamEnd(stream) {
|
||||||
function Parser_findASCII85DecodeInlineStreamEnd(stream) {
|
|
||||||
var TILDE = 0x7E, GT = 0x3E;
|
var TILDE = 0x7E, GT = 0x3E;
|
||||||
var startPos = stream.pos, ch, length;
|
var startPos = stream.pos, ch, length;
|
||||||
while ((ch = stream.getByte()) !== -1) {
|
while ((ch = stream.getByte()) !== -1) {
|
||||||
if (ch === TILDE && stream.peekByte() === GT) {
|
if (ch === TILDE) {
|
||||||
stream.skip();
|
ch = stream.peekByte();
|
||||||
break;
|
// Handle corrupt PDF documents which contains whitespace "inside" of
|
||||||
|
// the EOD marker (fixes issue10614.pdf).
|
||||||
|
while (isSpace(ch)) {
|
||||||
|
stream.skip();
|
||||||
|
ch = stream.peekByte();
|
||||||
|
}
|
||||||
|
if (ch === GT) {
|
||||||
|
stream.skip();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
length = stream.pos - startPos;
|
length = stream.pos - startPos;
|
||||||
|
1
test/pdfs/issue10614.pdf.link
Normal file
1
test/pdfs/issue10614.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://github.com/mozilla/pdf.js/files/2927954/FOX.ALEXANDER.F.VS.FOX.BARBARA.E.2015-004684-FC-04.Doc-46-Memorandum-of-Law.Fla.11th.Cir.Ct.May.31.2016.pdf
|
@ -1465,6 +1465,14 @@
|
|||||||
"link": false,
|
"link": false,
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue10614",
|
||||||
|
"file": "pdfs/issue10614.pdf",
|
||||||
|
"md5": "c41da60ce9af100cb78e1c2a6ba18232",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"lastPage": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue6071",
|
{ "id": "issue6071",
|
||||||
"file": "pdfs/issue6071.pdf",
|
"file": "pdfs/issue6071.pdf",
|
||||||
"md5": "2e08526d8e7c9ba4269fc12ef488d3eb",
|
"md5": "2e08526d8e7c9ba4269fc12ef488d3eb",
|
||||||
|
Loading…
Reference in New Issue
Block a user