vcl/source/fontsubset/sft.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 316c50766c9ad4021a3b0732b3fbb03c4b880c64
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Mar 6 17:58:29 2022 +0000
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Mar 7 12:16:57 2022 +0100

    ofz#45255 handle short O_hhea table
    
    Change-Id: I649dfdb3eff868441125fbf62ff3c7d0d18d8d19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131016
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 1734463ae1a8..706ef5c8b9df 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1751,7 +1751,7 @@ SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont  
*ttf,
 
     /**                       hhea                         **/
     p = ttf->table(O_hhea, nTableSize);
-    if (p)
+    if (p && nTableSize >= HHEA_caretSlopeRun_offset + 2)
         hhea = TrueTypeTableNew_hhea(GetInt16(p, HHEA_ascender_offset), 
GetInt16(p, HHEA_descender_offset), GetInt16(p, HHEA_lineGap_offset), 
GetInt16(p, HHEA_caretSlopeRise_offset), GetInt16(p, 
HHEA_caretSlopeRun_offset));
     else
         hhea = TrueTypeTableNew_hhea(0, 0, 0, 0, 0);

Reply via email to