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

New commits:
commit 4e93ba94f1969b672632319fc45db02f6558f87e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Mar 6 17:58:29 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Mar 6 20:33:27 2022 +0100

    ofz#45255 handle short O_hhea table
    
    Change-Id: I649dfdb3eff868441125fbf62ff3c7d0d18d8d19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131084
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 875eeb96730e..1991683434ad 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