diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-25 14:36:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-25 21:33:54 +0200 |
commit | 713fb4a8d3a19440013ca423f048ff6431c11d14 (patch) | |
tree | 5305cafa042ed0861cb5084a3e01dd8dfbf953a5 /xmloff/source/draw/ximpshap.cxx | |
parent | db4d4bac22d73e93729261739cda06382883b8f8 (diff) |
ofz#3786 Integer-overflow
Change-Id: I2f9b404ad5529842b40439e24e35aa5ab9b69531
Reviewed-on: https://gerrit.libreoffice.org/43840
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmloff/source/draw/ximpshap.cxx')
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index bdc453b969e4..7a77be7d0fa3 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -82,6 +82,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/vector/b2dvector.hxx> +#include <o3tl/safeint.hxx> #include <config_features.h> @@ -850,19 +851,19 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rL { GetImport().GetMM100UnitConverter().convertMeasureToCore( maSize.Width, rValue); - if( maSize.Width > 0 ) - maSize.Width += 1; - else if( maSize.Width < 0 ) - maSize.Width -= 1; + if (maSize.Width > 0) + maSize.Width = o3tl::saturating_add(maSize.Width, 1); + else if (maSize.Width < 0) + maSize.Width = o3tl::saturating_add(maSize.Width, -1); } else if( IsXMLToken( rLocalName, XML_HEIGHT ) ) { GetImport().GetMM100UnitConverter().convertMeasureToCore( maSize.Height, rValue); - if( maSize.Height > 0 ) - maSize.Height += 1; - else if( maSize.Height < 0 ) - maSize.Height -= 1; + if (maSize.Height > 0) + maSize.Height = o3tl::saturating_add(maSize.Height, 1); + else if (maSize.Height < 0) + maSize.Height = o3tl::saturating_add(maSize.Height, -1); } else if( IsXMLToken( rLocalName, XML_TRANSFORM ) ) { |