vcl/source/fontsubset/sft.cxx |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 42e50d6691f72cbe0d5c52cc5222b7f9da4d83c2
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Feb 28 20:49:20 2022 +0000
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Mar 1 18:35:25 2022 +0100

    ofz: verify table offsets
    
    Change-Id: I49fa886508b3bf553d4f638bfe53c37fa3e2f338
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130683
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index baa54d3378b7..867e00b47e0b 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1654,11 +1654,20 @@ SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont  
*ttf,
 
     /**                       post                          **/
     if ((p = ttf->table(O_post, nTableSize)) != nullptr)
+    {
+        sal_Int32 nItalic = (POST_italicAngle_offset + 4 < nTableSize) ?
+            GetInt32(p, POST_italicAngle_offset) : 0;
+        sal_Int16 nPosition = (POST_underlinePosition_offset + 2 < nTableSize) 
?
+            GetInt16(p, POST_underlinePosition_offset) : 0;
+        sal_Int16 nThickness = (POST_underlineThickness_offset + 2 < 
nTableSize) ?
+            GetInt16(p, POST_underlineThickness_offset) : 0;
+        sal_uInt32 nFixedPitch = (POST_isFixedPitch_offset + 4 < nTableSize) ?
+            GetUInt32(p, POST_isFixedPitch_offset) : 0;
+
         post = TrueTypeTableNew_post(0x00030000,
-                                     GetInt32(p, POST_italicAngle_offset),
-                                     GetInt16(p, 
POST_underlinePosition_offset),
-                                     GetInt16(p, 
POST_underlineThickness_offset),
-                                     GetUInt32(p, POST_isFixedPitch_offset));
+                                     nItalic, nPosition,
+                                     nThickness, nFixedPitch);
+    }
     else
         post = TrueTypeTableNew_post(0x00030000, 0, 0, 0, 0);
 

Reply via email to