diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-26 21:40:20 +0000 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-03-04 11:31:49 +0100 |
commit | 1392cbe668909f9880b8c33f0996c65894bf36f2 (patch) | |
tree | 30218f2f01c20f93416ae6d678edc0452166327b /vcl | |
parent | 75459ccd73426f83d8ce1c5e4ecd2ddb6ec94607 (diff) |
ofz#45073 don't dereference null pointer on bogus font
Change-Id: I28616696833b87c300d2ee7061a15921042934b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130613
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130937
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 7 | ||||
-rw-r--r-- | vcl/source/fontsubset/ttcr.cxx | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index a6337321dca2..9a1f2f87a33d 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2182,8 +2182,13 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info) GlyphData *GetTTRawGlyphData(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID) { + sal_uInt32 hmtxlength; + const sal_uInt8* hmtx = ttf->table(O_hmtx, hmtxlength); + + if (!hmtxlength) + return nullptr; + sal_uInt32 length; - const sal_uInt8* hmtx = ttf->table(O_hmtx, length); const sal_uInt8* glyf = ttf->table(O_glyf, length); int n; diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index 86dc02206e92..40729ffd101d 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -1250,7 +1250,11 @@ static void ProcessTables(TrueTypeCreator *tt) glyf = FindTable(tt, T_glyf); glyphlist = static_cast<list>(glyf->data); nGlyphs = listCount(glyphlist); - assert(nGlyphs != 0); + if (!nGlyphs) + { + SAL_WARN("vcl.fonts", "no glyphs found in ProcessTables"); + return; + } gid = static_cast<sal_uInt32*>(scalloc(nGlyphs, sizeof(sal_uInt32))); RemoveTable(tt, T_loca); |