[Pkg-javascript-commits] [pdf.js] 04/106: Fix error reading concatenated pdfs

David Prévot taffit at moszumanska.debian.org
Sat Jun 20 21:33:27 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 d0ea772fc698f1893839f11fb8ca1d1f00bfd048
Author: Jordan Thoms <jordan at thoms.net.nz>
Date:   Sat Apr 4 19:15:31 2015 +1300

    Fix error reading concatenated pdfs
---
 src/core/obj.js         |  13 +++++++------
 test/pdfs/.gitignore    |   1 +
 test/pdfs/issue5909.pdf | Bin 0 -> 109769 bytes
 test/test_manifest.json |   6 ++++++
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/core/obj.js b/src/core/obj.js
index 2037688..3298806 100644
--- a/src/core/obj.js
+++ b/src/core/obj.js
@@ -1051,12 +1051,13 @@ var XRef = (function XRefClosure() {
           trailers.push(position);
           position += skipUntil(buffer, position, startxrefBytes);
         } else if ((m = /^(\d+)\s+(\d+)\s+obj\b/.exec(token))) {
-          this.entries[m[1]] = {
-            offset: position,
-            gen: m[2] | 0,
-            uncompressed: true
-          };
-
+          if (typeof this.entries[m[1]] === 'undefined') {
+            this.entries[m[1]] = {
+              offset: position,
+              gen: m[2] | 0,
+              uncompressed: true
+            };
+          }
           var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
           var content = buffer.subarray(position, position + contentLength);
 
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index d65b22c..a049730 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -123,3 +123,4 @@
 !issue5481.pdf
 !issue5567.pdf
 !issue5701.pdf
+!issue5909.pdf
diff --git a/test/pdfs/issue5909.pdf b/test/pdfs/issue5909.pdf
new file mode 100755
index 0000000..4257718
Binary files /dev/null and b/test/pdfs/issue5909.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 5a51151..e4ac370 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -2087,5 +2087,11 @@
        "md5": "d5b37f8bf1b3aafa1b4fcf19ebdc7c74",
        "rounds": 1,
        "type": "eq"
+    },
+    {  "id": "issue5909",
+       "file": "pdfs/issue5909.pdf",
+       "md5": "51a724136c0c10008bd061a78ea4b8fc",
+       "rounds": 1,
+       "type": "load"
     }
 ]

-- 
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