mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
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
3 changed files with 22 additions and 5 deletions
|
@ -336,14 +336,22 @@ var Parser = (function ParserClosure() {
|
|||
* Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream.
|
||||
* @returns {number} The inline stream length.
|
||||
*/
|
||||
findASCII85DecodeInlineStreamEnd:
|
||||
function Parser_findASCII85DecodeInlineStreamEnd(stream) {
|
||||
findASCII85DecodeInlineStreamEnd(stream) {
|
||||
var TILDE = 0x7E, GT = 0x3E;
|
||||
var startPos = stream.pos, ch, length;
|
||||
while ((ch = stream.getByte()) !== -1) {
|
||||
if (ch === TILDE && stream.peekByte() === GT) {
|
||||
stream.skip();
|
||||
break;
|
||||
if (ch === TILDE) {
|
||||
ch = stream.peekByte();
|
||||
// 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue