diff --git a/src/core/parser.js b/src/core/parser.js index eeb42a00b..e828cec84 100644 --- a/src/core/parser.js +++ b/src/core/parser.js @@ -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); } diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index cb7707886..53730d89d 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -65,6 +65,7 @@ !simpletype3font.pdf !sizes.pdf !javauninstall-7r.pdf +!multiple-filters-length-zero.pdf !issue3205r.pdf !issue3207r.pdf !issue3263r.pdf diff --git a/test/pdfs/multiple-filters-length-zero.pdf b/test/pdfs/multiple-filters-length-zero.pdf new file mode 100644 index 000000000..721018a71 Binary files /dev/null and b/test/pdfs/multiple-filters-length-zero.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 531e054fb..72caae358 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1544,6 +1544,13 @@ "lastPage": 1, "type": "eq" }, + { "id": "multiple-filters-length-zero", + "file": "pdfs/multiple-filters-length-zero.pdf", + "md5": "c273c3a6fb79cbf3034fe1b62b204728", + "rounds": 1, + "link": false, + "type": "eq" + }, { "id": "issue5752", "file": "pdfs/issue5752.pdf", "md5": "aa20ad7cff71e9481c0cd623ddbff3b7",