summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-07-28 16:06:14 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-07-28 20:36:59 +0200
commitc97df0d704bfa5eebe573386445abfa4dcfd95b8 (patch)
treec7c31cc9efbd99889e7cd101925f9143a1881976
parente5ee79b5c089e72e6b24c04c7c820d706bd39993 (diff)
ofz#9613 Integer-overflow in shadow multiplication
Change-Id: I1c7dda7391987ea7bf5aa841aab576af0fc3759e Reviewed-on: https://gerrit.libreoffice.org/58219 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--editeng/source/items/frmitems.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 951a19fc77b3..f66dfff63a63 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -84,6 +84,7 @@
#include <editeng/editerr.hxx>
#include <libxml/xmlwriter.h>
#include <o3tl/enumrange.hxx>
+#include <o3tl/safeint.hxx>
#include <vcl/GraphicLoader.hxx>
using namespace ::editeng;
@@ -1127,10 +1128,10 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
case MID_SHADOW_TRANSPARENCE:
{
sal_Int32 nTransparence = 0;
- if (rVal >>= nTransparence)
+ if ((rVal >>= nTransparence) && !o3tl::checked_multiply<sal_Int32>(nTransparence, 255, nTransparence))
{
Color aColor(aShadow.Color);
- aColor.SetTransparency(rtl::math::round(float(nTransparence * 255) / 100));
+ aColor.SetTransparency(rtl::math::round(float(nTransparence) / 100));
aShadow.Color = sal_Int32(aColor);
}
break;