diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-07 15:50:35 +0000 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-06-01 14:49:00 +0200 |
commit | 3084ad15a03093e09fdb4e6502cdcf92924888b2 (patch) | |
tree | 17391e551e759a23a1a21becd9989204bf27e0ff | |
parent | 0939dc7eb4de0f4f2c323322cbe7f887937335c1 (diff) |
check O_head size
Change-Id: Idf5d30eaed0196cfa9266e35131c538c606a0960
Reviewed-on: https://gerrit.libreoffice.org/49365
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit b10ae2faae6f3c448bbab71585550387e18cc248)
Reviewed-on: https://gerrit.libreoffice.org/49367
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index b34037ebdba1..150b21ec676a 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1555,7 +1555,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) int i; sal_uInt32 length, tag; sal_uInt32 tdoffset = 0; /* offset to TableDirectory in a TTC file. For TTF files is 0 */ - int indexfmt; sal_uInt32 TTCTag = GetInt32(t->ptr, 0, 1); @@ -1699,8 +1698,13 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) t->nglyphs = table_size >= 6 ? GetUInt16(table, 4, 1) : 0; table = getTable(t, O_head); + table_size = getTableSize(t, O_head); + if (table_size < 52) { + CloseTTFont(t); + return SF_TTFORMAT; + } t->unitsPerEm = GetUInt16(table, 18, 1); - indexfmt = GetInt16(table, 50, 1); + int indexfmt = GetInt16(table, 50, 1); if( ((indexfmt != 0) && (indexfmt != 1)) || (t->unitsPerEm <= 0) ) { CloseTTFont(t); |