Merge pull request #11387 from Snuffleupagus/issue-11385

Handle corrupt ASCII85Decode inline images with truncated EOD markers (issue 11385)
This commit is contained in:
Tim van der Meij 2019-12-08 20:27:46 +01:00 committed by GitHub
commit a6db045789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View File

@ -344,6 +344,8 @@ class Parser {
let startPos = stream.pos, ch, length;
while ((ch = stream.getByte()) !== -1) {
if (ch === TILDE) {
const tildePos = stream.pos;
ch = stream.peekByte();
// Handle corrupt PDF documents which contains whitespace "inside" of
// the EOD marker (fixes issue10614.pdf).
@ -355,6 +357,14 @@ class Parser {
stream.skip();
break;
}
// Handle corrupt PDF documents which contains truncated EOD markers,
// where the '>' character is missing (fixes issue11385.pdf).
if (stream.pos > tildePos) {
const maybeEI = stream.peekBytes(2);
if (maybeEI[0] === /* E = */ 0x45 && maybeEI[1] === /* I = */ 0x49) {
break;
}
}
}
}
length = stream.pos - startPos;

View File

@ -0,0 +1 @@
https://github.com/mozilla/pdf.js/files/3926686/problematic.pdf

View File

@ -1595,6 +1595,14 @@
"lastPage": 1,
"type": "eq"
},
{ "id": "issue11385",
"file": "pdfs/issue11385.pdf",
"md5": "cc04b23b845366857426a5aa6acf227b",
"rounds": 1,
"link": true,
"lastPage": 1,
"type": "eq"
},
{ "id": "issue6071",
"file": "pdfs/issue6071.pdf",
"md5": "2e08526d8e7c9ba4269fc12ef488d3eb",