Merge pull request #5964 from Snuffleupagus/bug-1157493

Handle the Encoding being a dictionary in PartialEvaluator_preEvaluateFont (bug 1157493)
This commit is contained in:
Brendan Dahl 2015-05-05 14:41:32 -07:00
commit cd53cbe7d4
5 changed files with 27 additions and 0 deletions

View File

@ -1571,6 +1571,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

@ -33,6 +33,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

@ -1171,6 +1171,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",