[Pkg-javascript-commits] [pdf.js] 91/119: Handle the Encoding being a dictionary in PartialEvaluator_preEvaluateFont (bug 1157493)
David Prévot
taffit at moszumanska.debian.org
Wed May 13 21:27:45 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 760222cf0b58bad4641b60e43cc7b659d935e5c8
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Sat Apr 25 13:27:10 2015 +0200
Handle the Encoding being a dictionary in PartialEvaluator_preEvaluateFont (bug 1157493)
*This is a regression from PR 4423.*
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1157493.
---
src/core/evaluator.js | 15 +++++++++++++++
src/core/obj.js | 4 ++++
test/pdfs/.gitignore | 1 +
test/pdfs/bug1157493.pdf | Bin 0 -> 68735 bytes
test/test_manifest.json | 7 +++++++
5 files changed, 27 insertions(+)
diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 418ef0d..09f9cad 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -1567,6 +1567,21 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
hash.update(encoding.name);
} else if (isRef(encoding)) {
hash.update(encoding.num + '_' + encoding.gen);
+ } else if (isDict(encoding)) {
+ var keys = encoding.getKeys();
+ for (var i = 0, ii = keys.length; i < ii; i++) {
+ var entry = encoding.getRaw(keys[i]);
+ if (isName(entry)) {
+ hash.update(entry.name);
+ } else if (isRef(entry)) {
+ hash.update(entry.num + '_' + entry.gen);
+ } else if (isArray(entry)) { // 'Differences' entry.
+ // Ideally we should check the contents of the array, but to avoid
+ // parsing it here and then again in |extractDataStructures|,
+ // we only use the array length for now (fixes bug1157493.pdf).
+ hash.update(entry.length.toString());
+ }
+ }
}
var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
diff --git a/src/core/obj.js b/src/core/obj.js
index 833ca42..29b4a87 100644
--- a/src/core/obj.js
+++ b/src/core/obj.js
@@ -192,6 +192,10 @@ var Dict = (function DictClosure() {
return all;
},
+ getKeys: function Dict_getKeys() {
+ return Object.keys(this.map);
+ },
+
set: function Dict_set(key, value) {
this.map[key] = value;
},
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index 3544445..e9d8d0e 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -32,6 +32,7 @@
!bug894572.pdf
!bug911034.pdf
!bug1108301.pdf
+!bug1157493.pdf
!pdfjsbad1586.pdf
!freeculture.pdf
!pdfkit_compressed.pdf
diff --git a/test/pdfs/bug1157493.pdf b/test/pdfs/bug1157493.pdf
new file mode 100644
index 0000000..0dfef22
Binary files /dev/null and b/test/pdfs/bug1157493.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index e136ebc..da0a9db 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -1164,6 +1164,13 @@
"link": false,
"type": "eq"
},
+ { "id": "bug1157493",
+ "file": "pdfs/bug1157493.pdf",
+ "md5": "df96eddacf186c28a91e699800180c4f",
+ "rounds": 1,
+ "link": false,
+ "type": "eq"
+ },
{ "id": "issue1466",
"file": "pdfs/issue1466.pdf",
"md5": "8a8877432e5bb10cfd50d60488d947bb",
--
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