Kaydet (Commit) 402c7107 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

check kern table size

Change-Id: I65b5f0a8950d54c00d6fd7c385ca1c5dca2ef2c8
Reviewed-on: https://gerrit.libreoffice.org/49384Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
(cherry picked from commit d566c200)
üst 786fbea4
...@@ -1355,7 +1355,7 @@ static void GetKern(TrueTypeFont *ttf) ...@@ -1355,7 +1355,7 @@ static void GetKern(TrueTypeFont *ttf)
if( !table ) if( !table )
goto badtable; goto badtable;
if (GetUInt16(table, 0) == 0) { /* Traditional Microsoft style table with sal_uInt16 version and nTables fields */ if (nTableSize >= 4 && GetUInt16(table, 0) == 0) { /* Traditional Microsoft style table with sal_uInt16 version and nTables fields */
ttf->nkern = GetUInt16(table, 2); ttf->nkern = GetUInt16(table, 2);
ttf->kerntype = KT_MICROSOFT; ttf->kerntype = KT_MICROSOFT;
ptr = table + 4; ptr = table + 4;
...@@ -1387,7 +1387,7 @@ static void GetKern(TrueTypeFont *ttf) ...@@ -1387,7 +1387,7 @@ static void GetKern(TrueTypeFont *ttf)
return; return;
} }
if (GetUInt32(table, 0) == 0x00010000) { /* MacOS style kern tables: fixed32 version and sal_uInt32 nTables fields */ if (nTableSize >= 8 && GetUInt32(table, 0) == 0x00010000) { /* MacOS style kern tables: fixed32 version and sal_uInt32 nTables fields */
ttf->nkern = GetUInt32(table, 4); ttf->nkern = GetUInt32(table, 4);
ttf->kerntype = KT_APPLE_NEW; ttf->kerntype = KT_APPLE_NEW;
ptr = table + 8; ptr = table + 8;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment