summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-28 13:07:12 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-02-28 17:21:12 +0100
commit0969f23a2fde82863ece428fbfe81c62a8d8fff8 (patch)
treed8285d13d43d10173a60e956342917c90934ba27 /vcl
parent42ca32d7a37631dda3fa900ab9f2169234b1f4b3 (diff)
ofz#45117 Integer-overflow
Change-Id: I1827c1bf3e0153d071b354f9b958d5f84bb2d8a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130710 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/fontsubset/sft.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index c2d439eda607..685e923d31e4 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -593,9 +593,9 @@ static int GetCompoundTTOutline(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, C
cp.flags = nextComponent[i].flags;
const sal_uInt16 x = nextComponent[i].x;
const sal_uInt16 y = nextComponent[i].y;
- t = fixedMulDiv(a, x << 16, m) + fixedMulDiv(c, y << 16, m) + sal_Int32(sal_uInt16(e) << 16);
+ t = o3tl::saturating_add(o3tl::saturating_add(fixedMulDiv(a, x << 16, m), fixedMulDiv(c, y << 16, m)), sal_Int32(sal_uInt16(e) << 16));
cp.x = static_cast<sal_Int16>(fixedMul(t, m) >> 16);
- t = fixedMulDiv(b, x << 16, n) + fixedMulDiv(d, y << 16, n) + sal_Int32(sal_uInt16(f) << 16);
+ t = o3tl::saturating_add(o3tl::saturating_add(fixedMulDiv(b, x << 16, n), fixedMulDiv(d, y << 16, n)), sal_Int32(sal_uInt16(f) << 16));
cp.y = static_cast<sal_Int16>(fixedMul(t, n) >> 16);
myPoints.push_back( cp );