From f92e1fa160bc24dcec181101c6dd2002718f3a29 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Fri, 14 May 2021 18:34:51 +0200 Subject: [PATCH] Replace terminal null char by a endchar command in CFF charstrings to make OTS happy --- src/core/cff_parser.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/cff_parser.js b/src/core/cff_parser.js index a6c7bae35..32d1effe9 100644 --- a/src/core/cff_parser.js +++ b/src/core/cff_parser.js @@ -599,6 +599,12 @@ const CFFParser = (function CFFParserClosure() { } else if (value === 11) { state.stackSize = stackSize; return true; + } else if (value === 0 && j === data.length) { + // Operator 0 is not used according to the current spec and + // it's the last char and consequently it's likely a terminator. + // So just replace it by endchar command to make OTS happy. + data[j - 1] = 14; + validationCommand = CharstringValidationData[14]; } else { validationCommand = CharstringValidationData[value]; }