summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-14 10:29:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-14 15:28:44 +0200
commit97e49876086bbdcb58ae0c22d9145c453f239468 (patch)
tree202257093db0b02a1dcfbb22543b65fd4f3217ec /vcl/source/window
parentfa575be1e59b333a9aadcf4161686dfae2faa555 (diff)
tdf#135526 ranges overflowing to become negative
the properties panel uses huge min/maxes which can overflow when the number of digits changes Change-Id: Idbb998a065ce8f2b918fceea2076b794cbde3368 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100731 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/builder.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index b7e77efb7c17..b0cb0e053fce 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -342,7 +342,12 @@ namespace weld
int MetricSpinButton::ConvertValue(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const
{
- return vcl::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit);
+ auto nRet = vcl::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit);
+ if (nRet > SAL_MAX_INT32)
+ nRet = SAL_MAX_INT32;
+ else if (nRet < SAL_MIN_INT32)
+ nRet = SAL_MIN_INT32;
+ return nRet;
}
IMPL_LINK(MetricSpinButton, spin_button_input, int*, result, bool)