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>
This commit is contained in:
Caolán McNamara 2018-05-31 17:22:36 +01:00
parent 56a7ddaadc
commit 7488943c32

View file

@ -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;