summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-28 20:49:20 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2022-03-01 18:35:13 +0100
commit9b5a94d2270ec8edff0b0a15fdf3cfe01b55ef24 (patch)
tree8dc37196923ff0726098dd9787c31cb590353de6 /vcl/source
parente2969df08f165fd39654a2f0fb3dcee9885703a3 (diff)
ofz: verify table offsets
Change-Id: I49fa886508b3bf553d4f638bfe53c37fa3e2f338 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130682 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/fontsubset/sft.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 4d2eba36c7f3..bdc7e8208793 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1647,11 +1647,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);