mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #7698 from Snuffleupagus/bug-1308536
Ignore reserved commands when parsing operands in `CFFParser_parseDict`, instead of just rejecting the entire font (bug 1308536)
This commit is contained in:
commit
b4100ba651
5 changed files with 50 additions and 12 deletions
|
@ -349,9 +349,9 @@ var CFFParser = (function CFFParserClosure() {
|
|||
} else if (value >= 251 && value <= 254) {
|
||||
return -((value - 251) * 256) - dict[pos++] - 108;
|
||||
} else {
|
||||
error('255 is not a valid DICT command');
|
||||
warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
|
||||
return NaN;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function parseFloatOperand() {
|
||||
|
@ -1000,19 +1000,22 @@ var CFFDict = (function CFFDictClosure() {
|
|||
if (!(key in this.keyToNameMap)) {
|
||||
return false;
|
||||
}
|
||||
var valueLength = value.length;
|
||||
// ignore empty values
|
||||
if (value.length === 0) {
|
||||
if (valueLength === 0) {
|
||||
return true;
|
||||
}
|
||||
// Ignore invalid values (fixes bug1068432.pdf and bug1308536.pdf).
|
||||
for (var i = 0; i < valueLength; i++) {
|
||||
if (isNaN(value[i])) {
|
||||
warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
var type = this.types[key];
|
||||
// remove the array wrapping these types of values
|
||||
if (type === 'num' || type === 'sid' || type === 'offset') {
|
||||
value = value[0];
|
||||
// Ignore invalid values (fixes bug 1068432).
|
||||
if (isNaN(value)) {
|
||||
warn('Invalid CFFDict value: ' + value + ', for key: ' + key + '.');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.values[key] = value;
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue