diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-07-15 13:54:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-07-15 17:38:17 +0200 |
commit | 49c9b3723056addb0a443eaee71c8aacbdda4dc6 (patch) | |
tree | e171567c6b0bf34a34d443b0513276633259b43c /xmloff | |
parent | 1116fd2aa47cf6084eba83232c1094d5d23a268d (diff) |
ofz#15797 Integer-overflow
Change-Id: I623c934f5bb031d383dcf1ce779521a942f99bdf
Reviewed-on: https://gerrit.libreoffice.org/75634
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/xmlbahdl.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx index 488a5873f83b..695d78f087f6 100644 --- a/xmloff/source/style/xmlbahdl.cxx +++ b/xmloff/source/style/xmlbahdl.cxx @@ -21,6 +21,7 @@ #include <sal/log.hxx> #include <o3tl/any.hxx> +#include <o3tl/safeint.hxx> #include <sax/tools/converter.hxx> #include <xmloff/xmluconv.hxx> #include <com/sun/star/uno/Any.hxx> @@ -377,9 +378,11 @@ XMLNegPercentPropHdl::~XMLNegPercentPropHdl() bool XMLNegPercentPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const { sal_Int32 nValue = 0; - bool const bRet = ::sax::Converter::convertPercent( nValue, rStrImpValue ); - lcl_xmloff_setAny( rValue, 100-nValue, nBytes ); - + bool bRet = ::sax::Converter::convertPercent( nValue, rStrImpValue ); + if (bRet) + bRet = !o3tl::checked_sub<sal_Int32>(100, nValue, nValue); + if (bRet) + lcl_xmloff_setAny( rValue, nValue, nBytes ); return bRet; } |