diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-31 17:22:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-31 22:03:17 +0200 |
commit | 7488943c329516c35504fe86c36251c83b24cf74 (patch) | |
tree | 2989f37a0129d808fc795db2485f357280c21ce7 /oox | |
parent | 56a7ddaadc4a6fd7fc4019813041e93b10c91504 (diff) |
ofz#8651 Integer-overflow
Change-Id: I0498303d846cd6a2756b91be3d90ec0bf9926a34
Reviewed-on: https://gerrit.libreoffice.org/55142
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 6b496b50e3a0..d304e63ca1d3 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -22,6 +22,7 @@ #include <boost/optional.hpp> +#include <o3tl/safeint.hxx> #include <oox/vml/vmlshape.hxx> #include <vcl/wmf.hxx> #include <vcl/virdev.hxx> @@ -201,8 +202,14 @@ awt::Rectangle ShapeType::getAbsRectangle() const if ( nHeight == 0 ) nHeight = 1; - sal_Int32 nLeft = ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maLeft, 0, true, true ) - + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true ); + sal_Int32 nLeft; + if (o3tl::checked_add<sal_Int32>(ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maLeft, 0, true, true), + ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true), + nLeft)) + { + SAL_WARN("oox", "overflow in addition"); + nLeft = 0; + } if (nLeft == 0 && maTypeModel.maPosition == "absolute") nLeft = 1; |