diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-07 16:51:32 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-06 15:09:10 +0100 |
commit | caa1c9e35ab89248a914cad80eb302f14b5a98e9 (patch) | |
tree | b164252d17b068d34944172170e61a5a12a64a2a /vcl | |
parent | 402c71072b59cc2efbd1b6a6c8b48d291b785061 (diff) |
what matters is the availability of the last element, not the first
Change-Id: I23d3abdbe62b735d66261fb337613da88cc4206b
Reviewed-on: https://gerrit.libreoffice.org/49380
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit f975fbf50ef6da9d610885eb7ca46d93ef779481)
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 3d34c9e253b7..f1fb0d361d01 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2569,7 +2569,8 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info) info->symbolEncoded = (ttf->cmapType == CMAP_MS_Symbol); const sal_uInt8* table = getTable(ttf, O_OS2); - if (table) { + sal_uInt32 table_size = getTableSize(ttf, O_OS2); + if (table && table_size >= 42) { info->weight = GetUInt16(table, 4); info->width = GetUInt16(table, 6); @@ -2577,7 +2578,7 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info) * Microsoft old (78 bytes long) and Microsoft new (86 bytes long,) * Apple's documentation recommends looking at the table length. */ - if (getTableSize(ttf, O_OS2) > 68) { + if (table_size >= 78) { info->typoAscender = XUnits(UPEm,GetInt16(table, 68)); info->typoDescender = XUnits(UPEm, GetInt16(table, 70)); info->typoLineGap = XUnits(UPEm, GetInt16(table, 72)); |