diff --git a/src/parser.js b/src/parser.js index 3c9408f6b..d0dee45ee 100644 --- a/src/parser.js +++ b/src/parser.js @@ -230,6 +230,9 @@ var Parser = (function ParserClosure() { return stream; }, makeFilter: function Parser_makeFilter(stream, name, length, params) { + if (stream.dict.get('Length') === 0) { + return new NullStream(stream); + } if (name == 'FlateDecode' || name == 'Fl') { if (params) { return new PredictorStream(new FlateStream(stream), params); diff --git a/src/stream.js b/src/stream.js index 7b68800f1..2a898df81 100644 --- a/src/stream.js +++ b/src/stream.js @@ -2350,3 +2350,12 @@ var LZWStream = (function LZWStreamClosure() { return LZWStream; })(); +var NullStream = (function NullStreamClosure() { + function NullStream() { + Stream.call(this, new Uint8Array(0)); + } + + NullStream.prototype = Stream.prototype; + + return NullStream; +})();