diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-26 21:40:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-03-04 12:47:49 +0100 |
commit | 8906788e25296f3875682bad374e6845f4bb20e2 (patch) | |
tree | 0ffe0e6dc36a020e8790f3632b138266ab9d8681 /vcl | |
parent | e16281915ef61b657d60d9200abbe365dfc8acad (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/+/130936
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
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 6c515dabdee7..98b758064943 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2245,8 +2245,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); |