diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-07 17:26:04 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-09 10:15:49 +0000 |
commit | 1828490bb22f1c8273c4a9f5b1db819b173ca70d (patch) | |
tree | 55a20084cb95a9b104eafc6273ec75da2a733318 | |
parent | 603cb6cf31a5212d03736a552770e5734b0e8066 (diff) |
check more table sizes
Change-Id: I004a6d322f60d916cc4635b362ce948e8a10d7c7
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index f216c34622fb..b4fa7fd71495 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2403,14 +2403,18 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info) } table = getTable(ttf, O_head); /* 'head' tables is always there */ - info->xMin = XUnits(UPEm, GetInt16(table, 36)); - info->yMin = XUnits(UPEm, GetInt16(table, 38)); - info->xMax = XUnits(UPEm, GetInt16(table, 40)); - info->yMax = XUnits(UPEm, GetInt16(table, 42)); - info->macStyle = GetInt16(table, 44); + table_size = getTableSize(ttf, O_head); + if (table_size >= 46) { + info->xMin = XUnits(UPEm, GetInt16(table, 36)); + info->yMin = XUnits(UPEm, GetInt16(table, 38)); + info->xMax = XUnits(UPEm, GetInt16(table, 40)); + info->yMax = XUnits(UPEm, GetInt16(table, 42)); + info->macStyle = GetInt16(table, 44); + } table = getTable(ttf, O_hhea); - if (table) { + table_size = getTableSize(ttf, O_hhea); + if (table && table_size >= 10) { info->ascender = XUnits(UPEm, GetInt16(table, 4)); info->descender = XUnits(UPEm, GetInt16(table, 6)); info->linegap = XUnits(UPEm, GetInt16(table, 8)); |