toolkit/source/controls/dialogcontrol.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
New commits: commit 0ea2f9a1b33b446069935913c2b3c846d79b52de Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Mon Jul 26 21:45:51 2021 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Jul 27 07:33:39 2021 +0200 Avoid potential tools::Long vs. UNOIDL LONG mismatch As found when debugging tdf#143534 "Crash in Calc NLP Solver when saving a document in Write" on Linux x86-64 (where tools::Long is 64-bit long; while UNOIDL LONG is 32-bit): These ImplSetPropertyValues cause comphelper::OPropertyContainerHelper::convertFastPropertyValue to throw via lcl_throwIllegalPropertyValueTypeException due to the mismatch---which were then silently caught in UnoDialogControl::windowResized resp. UnoDialogControl::windowMoved. Change-Id: I9793204ad49737165e69de7d5e15445ba0e82c85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119535 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 25e8061e5e1b..c53b6c808751 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -17,7 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> +#include <algorithm> + +#include <sal/types.h> #include <vcl/svapp.hxx> #include <osl/mutex.hxx> #include <controls/dialogcontrol.hxx> @@ -507,8 +511,10 @@ void SAL_CALL UnoDialogControl::windowResized( const css::awt::WindowEvent& e ) // Properties in a sequence must be sorted! aProps[0] = "Height"; aProps[1] = "Width"; - aValues[0] <<= aAppFontSize.Height(); - aValues[1] <<= aAppFontSize.Width(); + aValues[0] <<= sal_Int32( + std::clamp(aAppFontSize.Height(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32))); + aValues[1] <<= sal_Int32( + std::clamp(aAppFontSize.Width(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32))); ImplSetPropertyValues( aProps, aValues, true ); mbSizeModified = false; @@ -533,8 +539,10 @@ void SAL_CALL UnoDialogControl::windowMoved( const css::awt::WindowEvent& e ) Sequence< Any > aValues( 2 ); aProps[0] = "PositionX"; aProps[1] = "PositionY"; - aValues[0] <<= aTmp.Width(); - aValues[1] <<= aTmp.Height(); + aValues[0] <<= sal_Int32( + std::clamp(aTmp.Width(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32))); + aValues[1] <<= sal_Int32( + std::clamp(aTmp.Height(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32))); ImplSetPropertyValues( aProps, aValues, true ); mbPosModified = false; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits