Kaydet (Commit) abc40178 authored tarafından Khaled Hosny's avatar Khaled Hosny

tdf#107605: Fix reading version 0 OS/2 font table

The version 0 table os exactly 78 bytes since it does not have any of
the extra fields from the later versions.

Change-Id: Ie2e478bdefb201b988dc0844240d4ff193d66583
Reviewed-on: https://gerrit.libreoffice.org/43374Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKhaled Hosny <khaledhosny@eglug.org>
üst 2c6e7f6c
...@@ -2396,7 +2396,7 @@ void GetTTFontMetrics(const std::vector<uint8_t>& hhea, ...@@ -2396,7 +2396,7 @@ void GetTTFontMetrics(const std::vector<uint8_t>& hhea,
* FIXME: horribly outdated comment and horrible code that uses hard-coded * FIXME: horribly outdated comment and horrible code that uses hard-coded
* offsets to read the table. * offsets to read the table.
*/ */
if (os2.size() > 76 + 2) if (os2.size() >= 76 + 2)
{ {
info->fsSelection = GetUInt16(os2.data(), 62); info->fsSelection = GetUInt16(os2.data(), 62);
info->typoAscender = GetInt16(os2.data(), 68); info->typoAscender = GetInt16(os2.data(), 68);
...@@ -2406,7 +2406,7 @@ void GetTTFontMetrics(const std::vector<uint8_t>& hhea, ...@@ -2406,7 +2406,7 @@ void GetTTFontMetrics(const std::vector<uint8_t>& hhea,
info->winDescent = GetUInt16(os2.data(), 76); info->winDescent = GetUInt16(os2.data(), 76);
} }
if (hhea.size() > 8 + 2) { if (hhea.size() >= 8 + 2) {
info->ascender = GetInt16(hhea.data(), 4); info->ascender = GetInt16(hhea.data(), 4);
info->descender = GetInt16(hhea.data(), 6); info->descender = GetInt16(hhea.data(), 6);
info->linegap = GetInt16(hhea.data(), 8); info->linegap = GetInt16(hhea.data(), 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