mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #2615 from vyv03354/master
Fixes CFF parser failure when CharStrings contains cntrmask
This commit is contained in:
commit
9af6e05456
2 changed files with 31 additions and 9 deletions
18
src/fonts.js
18
src/fonts.js
|
@ -5379,9 +5379,9 @@ var CFFFont = (function CFFFontClosure() {
|
|||
var CFFParser = (function CFFParserClosure() {
|
||||
var CharstringValidationData = [
|
||||
null,
|
||||
{ id: 'hstem', min: 2, resetStack: true },
|
||||
{ id: 'hstem', min: 2, resetStack: true, stem: true },
|
||||
null,
|
||||
{ id: 'vstem', min: 2, resetStack: true },
|
||||
{ id: 'vstem', min: 2, resetStack: true, stem: true },
|
||||
{ id: 'vmoveto', min: 1, resetStack: true },
|
||||
{ id: 'rlineto', min: 2, resetStack: true },
|
||||
{ id: 'hlineto', min: 1, resetStack: true },
|
||||
|
@ -5389,19 +5389,19 @@ var CFFParser = (function CFFParserClosure() {
|
|||
{ id: 'rrcurveto', min: 6, resetStack: true },
|
||||
null,
|
||||
{ id: 'callsubr', min: 1, undefStack: true },
|
||||
{ id: 'return', min: 0, resetStack: true },
|
||||
{ id: 'return', min: 0, undefStack: true },
|
||||
null, // 12
|
||||
null,
|
||||
null, // endchar
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ id: 'hstemhm', min: 2, resetStack: true },
|
||||
{ id: 'hstemhm', min: 2, resetStack: true, stem: true },
|
||||
null, // hintmask
|
||||
null, // cntrmask
|
||||
{ id: 'rmoveto', min: 2, resetStack: true },
|
||||
{ id: 'hmoveto', min: 1, resetStack: true },
|
||||
{ id: 'vstemhm', min: 2, resetStack: true },
|
||||
{ id: 'vstemhm', min: 2, resetStack: true, stem: true },
|
||||
{ id: 'rcurveline', min: 8, resetStack: true },
|
||||
{ id: 'rlinecurve', min: 8, resetStack: true },
|
||||
{ id: 'vvcurveto', min: 4, resetStack: true },
|
||||
|
@ -5417,7 +5417,7 @@ var CFFParser = (function CFFParserClosure() {
|
|||
null,
|
||||
{ id: 'and', min: 2, stackDelta: -1 },
|
||||
{ id: 'or', min: 2, stackDelta: -1 },
|
||||
{ id: 'not', min: 2, stackDelta: -1 },
|
||||
{ id: 'not', min: 1, stackDelta: 0 },
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -5737,9 +5737,6 @@ var CFFParser = (function CFFParserClosure() {
|
|||
} else if (value == 255) { // number (32 bit)
|
||||
j += 4;
|
||||
stackSize++;
|
||||
} else if (value == 18 || value == 23) {
|
||||
hints += stackSize >> 1;
|
||||
validationCommand = CharstringValidationData[value];
|
||||
} else if (value == 19 || value == 20) {
|
||||
hints += stackSize >> 1;
|
||||
j += (hints + 7) >> 3; // skipping right amount of hints flag data
|
||||
|
@ -5748,6 +5745,9 @@ var CFFParser = (function CFFParserClosure() {
|
|||
validationCommand = CharstringValidationData[value];
|
||||
}
|
||||
if (validationCommand) {
|
||||
if (validationCommand.stem) {
|
||||
hints += stackSize >> 1;
|
||||
}
|
||||
if ('min' in validationCommand) {
|
||||
if (!undefStack && stackSize < validationCommand.min) {
|
||||
warn('Not enough parameters for ' + validationCommand.id +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue