From fca12125306f3fb4e6197a63ff7fb9155eb9a8eb Mon Sep 17 00:00:00 2001 From: Josh Hadley Date: Fri, 29 Sep 2023 14:50:45 -0700 Subject: [PATCH] add guards for h->otl == NULL before calling otlSubtableAdd Testing in macOS 13.x revealed that there was no check for h->otl == NULL before calling otlSubtableAdd, which accesses h->otl in GPOSFill and GSUBFill routines. Without this check, otlSubtableAdd would fail with a segfault when h->otl was passed in NULL. --- c/makeotf/lib/hotconv/GPOS.c | 4 ++++ c/makeotf/lib/hotconv/GSUB.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/c/makeotf/lib/hotconv/GPOS.c b/c/makeotf/lib/hotconv/GPOS.c index 63cb918c5..f1ee06201 100644 --- a/c/makeotf/lib/hotconv/GPOS.c +++ b/c/makeotf/lib/hotconv/GPOS.c @@ -379,6 +379,10 @@ int GPOSFill(hotCtx g) { createAnonLookups(g, h); + if (h->otl == NULL) { + return 0; + } + /* Add OTL features */ /* See GSUB.c::GSUBFill() for an explanation of the subtable order */ diff --git a/c/makeotf/lib/hotconv/GSUB.c b/c/makeotf/lib/hotconv/GSUB.c index 0ee266653..dcc092ce6 100644 --- a/c/makeotf/lib/hotconv/GSUB.c +++ b/c/makeotf/lib/hotconv/GSUB.c @@ -217,6 +217,10 @@ int GSUBFill(hotCtx g) { createAnonLookups(g, h); + if (h->otl == NULL) { + return 0; + } + /* Add OTL features */ /* The font tables are in the order: