[Pkg-javascript-commits] [pdf.js] 166/207: Prevent CMapFactory.create from failing by passing the necessary parameters from PartialEvaluator_readToUnicode (issue 5010)

David Prévot taffit at moszumanska.debian.org
Mon Jul 28 15:36:44 UTC 2014


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

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

commit 04975acceb9e640889c4a5e6c7436ad6241cacf4
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Fri Jun 27 00:41:44 2014 +0200

    Prevent CMapFactory.create from failing by passing the necessary parameters from PartialEvaluator_readToUnicode (issue 5010)
---
 src/core/cmap.js        |   2 +-
 src/core/evaluator.js   |   8 +++++---
 test/pdfs/.gitignore    |   1 +
 test/pdfs/issue5010.pdf | Bin 0 -> 4443 bytes
 test/test_manifest.json |   9 +++++++++
 5 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/core/cmap.js b/src/core/cmap.js
index 792c679..1ea5f93 100644
--- a/src/core/cmap.js
+++ b/src/core/cmap.js
@@ -815,7 +815,7 @@ var CMapFactory = (function CMapFactoryClosure() {
     if (BUILT_IN_CMAPS.indexOf(name) === -1) {
       error('Unknown cMap name: ' + name);
     }
-    assert (builtInCMapParams, 'buildin cmap parameters are not provided');
+    assert(builtInCMapParams, 'built-in cMap parameters are not provided');
 
     if (builtInCMapParams.packed) {
       return parseBinaryCMap(name, builtInCMapParams);
diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 41945e5..2579ddf 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -1224,7 +1224,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
       // 9.10.2
       var toUnicode = (dict.get('ToUnicode') || baseDict.get('ToUnicode'));
       if (toUnicode) {
-        properties.toUnicode = this.readToUnicode(toUnicode, xref, properties);
+        properties.toUnicode = this.readToUnicode(toUnicode);
       }
       if (properties.composite) {
         // CIDSystemInfo helps to match CID to glyphs
@@ -1308,9 +1308,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
     readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
       var cmapObj = toUnicode;
       if (isName(cmapObj)) {
-        return CMapFactory.create(cmapObj).map;
+        return CMapFactory.create(cmapObj,
+          { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).map;
       } else if (isStream(cmapObj)) {
-        var cmap = CMapFactory.create(cmapObj).map;
+        var cmap = CMapFactory.create(cmapObj,
+          { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).map;
         // Convert UTF-16BE
         // NOTE: cmap can be a sparse array, so use forEach instead of for(;;)
         // to iterate over all keys.
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index debc332..463a475 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -66,6 +66,7 @@
 !noembed-sjis.pdf
 !vertical.pdf
 !bug878026.pdf
+!issue5010.pdf
 !issue4934.pdf
 !issue4650.pdf
 !issue3025.pdf
diff --git a/test/pdfs/issue5010.pdf b/test/pdfs/issue5010.pdf
new file mode 100644
index 0000000..cfee1c8
Binary files /dev/null and b/test/pdfs/issue5010.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 57eb4c9..17eea7a 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -436,6 +436,15 @@
        "lastPage": 1,
        "type": "eq"
     },
+    {  "id": "issue5010",
+       "file": "pdfs/issue5010.pdf",
+       "md5": "419f4b13403a0871c463ec69d96e342c",
+       "rounds": 1,
+       "link": false,
+       "firstPage": 1,
+       "lastPage": 1,
+       "type": "eq"
+    },
     {  "id": "issue4934",
        "file": "pdfs/issue4934.pdf",
        "md5": "6099da44f677702ae65a648b51a2226d",

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