From 87a4ebfb82bede3321aca79b256b7f96fc879f18 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Thu, 24 Nov 2022 18:15:48 +0200 Subject: [PATCH] Fix OTS warning about `maxp.maxSizeOfInstructions`. For some fonts, OTS gives the following warning: ``` WARNING: glyf: Bytecode length is bigger than maxp.maxSizeOfInstructions 17696: 17700 ``` In the 'glyf' table, the glyph's `instructionLength` value is set to `ins_extra_len + ins_len`, but when updating `sfnt->max_instructions`, only `ins_len` is considered. Fix this by taking `ins_extra_len` into account when updating `max_instructions`. --- lib/tabytecode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tabytecode.c b/lib/tabytecode.c index 0ad45e8..e8460f2 100644 --- a/lib/tabytecode.c +++ b/lib/tabytecode.c @@ -3063,8 +3063,8 @@ Done1: ins_len = (FT_UInt)(bufp - ins_buf); - if (ins_len > sfnt->max_instructions) - sfnt->max_instructions = (FT_UShort)ins_len; + if ((ins_len + glyph->ins_extra_len) > sfnt->max_instructions) + sfnt->max_instructions = (FT_UShort)(ins_len + glyph->ins_extra_len); glyph->ins_buf = (FT_Byte*)realloc(ins_buf, ins_len); glyph->ins_len = ins_len; -- 2.11.4.GIT