include/tools/gen.hxx | 3 +++ starmath/source/mathmlimport.cxx | 4 ++-- tools/source/generic/gen.cxx | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-)
New commits: commit fc6a8994055db18b9ba2dce1e26d2b1ea9ea41f3 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Mar 12 21:26:31 2018 +0000 ofz#6843 Integer-overflow Change-Id: I3984253ac3e5eaf0be7b10c8ba95d50e6bd9ce5d Reviewed-on: https://gerrit.libreoffice.org/51175 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 53f7fb716e3c..90486536c401 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -472,6 +472,9 @@ public: * Sanitizing variants for handling data from the outside */ void SaturatingSetSize(const Size& rSize); + void SaturatingSetX(long x); + void SaturatingSetY(long y); + private: long nLeft; long nTop; diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index ed207aaa0f0b..59b42570a2d0 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -3067,12 +3067,12 @@ void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps) if (pValue->Name == "ViewAreaTop" ) { pValue->Value >>= nTmp; - aRect.setY( nTmp ); + aRect.SaturatingSetY(nTmp); } else if (pValue->Name == "ViewAreaLeft" ) { pValue->Value >>= nTmp; - aRect.setX( nTmp ); + aRect.SaturatingSetX(nTmp); } else if (pValue->Name == "ViewAreaWidth" ) { diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 5fe6eeeaa3d6..ea855f98e9f0 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -85,6 +85,18 @@ void tools::Rectangle::SaturatingSetSize(const Size& rSize) nBottom = RECT_EMPTY; } +void tools::Rectangle::SaturatingSetX(long x) +{ + nRight = o3tl::saturating_add(nRight, x - nLeft); + nLeft = x; +} + +void tools::Rectangle::SaturatingSetY(long y) +{ + nBottom = o3tl::saturating_add(nBottom, y - nTop); + nTop = y; +} + tools::Rectangle& tools::Rectangle::Union( const tools::Rectangle& rRect ) { if ( rRect.IsEmpty() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits