From 0fd0cf33fd34ad811e3d4fed5de2b3d8f8486c34 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 1 Jul 2025 22:15:07 +0200 Subject: [PATCH] [autofit] Remove `globals->gsub_length`. We completely validate the accessed data from the 'GSUB' table, making this field unnecessary. * src/autofit/afglobal.h (AF_FaceGlobalsRec): Remove `gsub_length` field. * src/autofit/afglobal.c (af_face_globals_new), src/autofit/afgsub.c (af_parse_gsub): Updated. --- src/autofit/afglobal.c | 4 +--- src/autofit/afglobal.h | 2 -- src/autofit/afgsub.c | 8 ++------ 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index 0c9882f71..f82d249ee 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -373,9 +373,7 @@ globals->hb_font = NULL; globals->hb_buf = NULL; - globals->gsub_length = 0; - globals->gsub = NULL; - + globals->gsub = NULL; globals->gsub_lookups_single_alternate = NULL; } #endif diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h index 268524fe3..9ef27cbdf 100644 --- a/src/autofit/afglobal.h +++ b/src/autofit/afglobal.h @@ -115,9 +115,7 @@ FT_BEGIN_HEADER hb_buffer_t* hb_buf; /* for feature comparison */ /* The GSUB table. */ - FT_ULong gsub_length; FT_Byte* gsub; - /* Lookup offsets, with only SingleSubst and AlternateSubst non-NULL. */ FT_UInt32* gsub_lookups_single_alternate; #endif diff --git a/src/autofit/afgsub.c b/src/autofit/afgsub.c index 4f334fa2a..f11f987f3 100644 --- a/src/autofit/afgsub.c +++ b/src/autofit/afgsub.c @@ -310,9 +310,7 @@ FT_Byte* limit; - globals->gsub_length = 0; - globals->gsub = NULL; - + globals->gsub = NULL; globals->gsub_lookups_single_alternate = NULL; /* No error if we can't load or parse GSUB data. */ @@ -364,9 +362,7 @@ idx++; } - globals->gsub_length = gsub_length; - globals->gsub = gsub; - + globals->gsub = gsub; globals->gsub_lookups_single_alternate = gsub_lookups_single_alternate; return;