From 279efc6cc2ab167eb0c791b3b138d249c49778d7 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 29 Mar 2023 13:23:32 +0800 Subject: [PATCH] Update Android port * src/sfntfont.c (sfntfont_setup_interpreter): Don't create interpreter for blatently broken fonts. --- src/sfntfont.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sfntfont.c b/src/sfntfont.c index 40272247116..99ba6bb1001 100644 --- a/src/sfntfont.c +++ b/src/sfntfont.c @@ -2504,6 +2504,15 @@ sfntfont_setup_interpreter (struct sfnt_font_info *info, if (!fpgm && !prep) goto bail; + /* If the interpreter does not use the operand stack at all, it is + useless. In addition, some broken fonts specify some unnecessary + instructions in prep and set head->max_stack_elements to 0. + + Don't create the interpreter in that case. */ + + if (!info->maxp->max_stack_elements) + goto bail; + /* Now, create the interpreter using the limits in info->maxp and info->head. CVT can be NULL. */ -- 2.39.2