1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #8135 from jasonjensen/issue8097

Handle cff fonts with erroneous stackSize (issue 8097)
This commit is contained in:
Jonas Jenwald 2017-03-11 09:55:00 +01:00 committed by GitHub
commit 224613a511
4 changed files with 10 additions and 2 deletions

View file

@ -475,7 +475,7 @@ var CFFParser = (function CFFParserClosure() {
parseCharString: function CFFParser_parseCharString(state, data,
localSubrIndex,
globalSubrIndex) {
if (state.callDepth > MAX_SUBR_NESTING) {
if (!data || state.callDepth > MAX_SUBR_NESTING) {
return false;
}
var stackSize = state.stackSize;
@ -552,7 +552,8 @@ var CFFParser = (function CFFParserClosure() {
bias = 1131;
}
var subrNumber = stack[--stackSize] + bias;
if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
if (subrNumber < 0 || subrNumber >= subrsIndex.count ||
isNaN(subrNumber)) {
validationCommand = CharstringValidationData[value];
warn('Out of bounds subrIndex for ' + validationCommand.id);
return false;