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

New commits:
commit eb311b92cd78f7868a0df1b9c32f77a377398fc4
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sun Mar 6 17:58:29 2022 +0000
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Mar 7 12:16:42 2022 +0100

    ofz#45255 handle short O_hhea table
    
    Change-Id: I649dfdb3eff868441125fbf62ff3c7d0d18d8d19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131015
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index d4c905c068df..18748053029e 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1750,7 +1750,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