[Pkg-javascript-commits] [pdf.js] 37/109: Also check `maybeLength` when deciding if a stream is empty in `Parser_makeFilter` (issue 6360)

David Prévot taffit at moszumanska.debian.org
Fri Sep 25 03:04:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 5128603f64ff8053194050bd732900f282f76149
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Thu Aug 20 23:01:48 2015 +0200

    Also check `maybeLength` when deciding if a stream is empty in `Parser_makeFilter` (issue 6360)
    
    The problem with the PDF files in the issue, besides the obviously broken XRef tables which we're able to recover from, is that many/most of the streams have Dictionaries where the `Length` entry is set to `0`. This causes us to return `NullStream`, instead of the appropriate one in `Parser_makeFilter`.
    
    Fixes 6360.
---
 src/core/parser.js           | 2 +-
 test/pdfs/issue6360.pdf.link | 1 +
 test/test_manifest.json      | 9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/core/parser.js b/src/core/parser.js
index 62a2482..dbc02e3 100644
--- a/src/core/parser.js
+++ b/src/core/parser.js
@@ -524,7 +524,7 @@ var Parser = (function ParserClosure() {
       return stream;
     },
     makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
-      if (stream.dict.get('Length') === 0) {
+      if (stream.dict.get('Length') === 0 && !maybeLength) {
         return new NullStream(stream);
       }
       try {
diff --git a/test/pdfs/issue6360.pdf.link b/test/pdfs/issue6360.pdf.link
new file mode 100644
index 0000000..69a59d5
--- /dev/null
+++ b/test/pdfs/issue6360.pdf.link
@@ -0,0 +1 @@
+http://web.archive.org/web/20150820205437/https://s3-eu-west-1.amazonaws.com/document-api-images-prod/docs/KNJfiZ5NV_Nb8d9VJmbvnWQ-5tlAir_arkwCEN_4EnA/application-pdf?AWSAccessKeyId=ASIAJUC4JIACNAMOVPXQ&Expires=1440104129&Signature=ItgaKidUAi70YSE%2F4E1Fbp8XSP0%3D&x-amz-security-token=AQoDYXdzEJH%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEa4AMvYGaEfeu06eu1RFUPRoTnDKITutvSW8T1REdKtxHHq41ZRI%2FQL5hbzkEsy7gamqnktaoSpft5PBdrv5btUERD8LOA2tnbrOCCbodE3JubVkzMp4FIuZ%2F%2Fkpb%2F%2Be3dfG36VjpMvLWTKkitAsrFCEy5 [...]
diff --git a/test/test_manifest.json b/test/test_manifest.json
index e199599..9b6a9e8 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -1062,6 +1062,15 @@
       "link": true,
       "type": "eq"
     },
+    {  "id": "issue6360",
+       "file": "pdfs/issue6360.pdf",
+       "md5": "58c5455ffd84b1c07ad2d0fa90cd5e26",
+       "rounds": 1,
+       "link": true,
+       "firstPage": 1,
+       "lastPage": 1,
+       "type": "eq"
+    },
     {  "id": "issue2931",
        "file": "pdfs/issue2931.pdf",
        "md5": "ea40940eaf3541b312bda9329167da11",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list