1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Merge pull request #7670 from Snuffleupagus/Parser_makeFilter-maybeLength

Only skip parsing a stream in `Parser_makeFilter` when we know for sure that it is empty (PR 6372 follow-up)
This commit is contained in:
Yury Delendik 2016-10-05 10:38:12 -05:00 committed by GitHub
commit 7b2a9ee4e0
4 changed files with 12 additions and 1 deletions

View file

@ -564,7 +564,10 @@ var Parser = (function ParserClosure() {
return stream;
},
makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
if (stream.dict.get('Length') === 0 && !maybeLength) {
// Since the 'Length' entry in the stream dictionary can be completely
// wrong, e.g. zero for non-empty streams, only skip parsing the stream
// when we can be absolutely certain that it actually is empty.
if (maybeLength === 0) {
warn('Empty "' + name + '" stream.');
return new NullStream(stream);
}