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.
This commit is contained in:
Jonas Jenwald 2015-04-25 13:27:10 +02:00
parent 48b2f6d023
commit 760222cf0b
5 changed files with 27 additions and 0 deletions

View File

@ -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');

View File

@ -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;
},

View File

@ -32,6 +32,7 @@
!bug894572.pdf
!bug911034.pdf
!bug1108301.pdf
!bug1157493.pdf
!pdfjsbad1586.pdf
!freeculture.pdf
!pdfkit_compressed.pdf

BIN
test/pdfs/bug1157493.pdf Normal file

Binary file not shown.

View File

@ -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",