mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Handle corrupt ASCII85Decode inline images with truncated EOD markers (issue 11385)
In the PDF document in question, there's an ASCII85Decode inline image where the '>' part of EOD (end-of-data) marker is missing; hence the PDF document is corrupt.
This commit is contained in:
parent
514b500a6c
commit
5c0336872e
3 changed files with 19 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue