From 58d6974bf5a864a1dcc1eeafd22e1db9e1606ca8 Mon Sep 17 00:00:00 2001 From: Saebekassebil Date: Mon, 22 Oct 2012 17:53:15 +0200 Subject: [PATCH] Implement NullStream, fix #1832 --- src/parser.js | 3 +++ src/stream.js | 9 +++++++++ 2 files changed, 12 insertions(+) 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; +})();