diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-02-07 18:59:20 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-02-07 23:48:59 +0100 |
commit | dcd9e98383c767bbb6014c6ca5fe786579eda08f (patch) | |
tree | 8209bb73f79e6e11776eed7bb9bd7f9ecb9a3044 /vcl/source | |
parent | a56981e9f1710ae44637fa6a31a37dc40c0c445a (diff) |
float-cast-overflow
...after ea771e85b2302829394df545bb82c02bff2750c2 "Resolves: tdf#146997 use
sal_Int64 instead of sal_Int32 for spinbutton values" changed the default values
of pcr::ONumericControl::setMin/MaxValue
(extensions/source/propctrlr/standardcontrol.cxx) from int to sal_Int64 limits.
With SAL_USE_VCLPLUGIN=gtk3, in Writer creating a "Form - Label" and selecting
"Control Properties" in its context menu caused
> include/tools/helpers.hxx:75:93: runtime error: 9.22337e+18 is outside the range of representable values of type 'long'
> #0 in FRound(double) at include/tools/helpers.hxx:75:93
> #1 in (anonymous namespace)::GtkInstanceSpinButton::fromGtk(double) const at vcl/unx/gtk3/gtkinst.cxx:16443:16
> #2 in (anonymous namespace)::GtkInstanceSpinButton::get_range(long&, long&) const at vcl/unx/gtk3/gtkinst.cxx:16521:15
> #3 in weld::MetricSpinButton::update_width_chars() at vcl/source/window/builder.cxx:258:24
> #4 in weld::MetricSpinButton::set_range(long, long, FieldUnit) at include/vcl/weld.hxx:1991:9
> #5 in weld::MetricSpinButton::set_min(long, FieldUnit) at include/vcl/weld.hxx:2005:9
> #6 in pcr::ONumericControl::setMinValue(com::sun::star::beans::Optional<double> const&) at extensions/source/propctrlr/standardcontrol.cxx:401:38
and similarly for pcr::ONumericControl::setMaxValue:
For one, for fVal = -9223372036854775808 (i.e., -2^63), -fVal + 0.5 (i.e.,
9223372036854775808.5) was outside the range of 64-bit tools::Long, so rewrite
the non-positive branch in a simpler way (and I have no idea why it was written
in the more complex way in the first place).
For another, for fVal = 9223372036854775807 (i.e., 2^63 - 1), fVal + 0.5 (i.e.,
9223372036854775807.5) cannot be represented as IEEE 754 double exactly and is
represented as 9223372036854775808, which was similarly outside the range of
64-bit tools::Long, so treat that limit value specially on the positive branch.
Change-Id: Ic2a553e9ce6319eac591058b1218b29dffaeab2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129638
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source')
0 files changed, 0 insertions, 0 deletions