This presumably wants to be Size(-1, -1)

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 20 November 2020 07:04 UTC

The code had been introduced with bd837fcbae7662bd127cb214f1497e4bf750cab0 "#92085# GetRulerState(): setting of SID_RULER_LR_MIN_MAX corrected" (where the referenced bug is apparently from the lost Sun-internal bug tracker), at a time when Size was presumably based on signed long, so ULONG_MAX presumably already effectively meant -1 back then.

I don't understand what this code does, but when using a

Size(std::numeric_limits<::tools::Long>::max(), std::numeric_limits<::tools::Long>::max())

instead, in a 64-bit Linux UBSan build I got

> include/tools/gen.hxx:527:37: runtime error: signed integer overflow: 11767 + 9223372036854775806 cannot be represented in type 'long' > #0 in tools::Rectangle::Rectangle(Point const&, Size const&) at include/tools/gen.hxx:527:37 > #1 in sd::DrawViewShell::GetRulerState(SfxItemSet&) at sd/source/ui/view/drviews3.cxx:915:28 > #2 in SfxStubGraphicViewShellGetRulerState(SfxShell*, SfxItemSet&) at workdir/SdiTarget/sd/sdi/sdgslots.hxx:1540:1 > #3 in SfxShell::CallState(void (*)(SfxShell*, SfxItemSet&), SfxItemSet&) at include/sfx2/shell.hxx:199:35 > #4 in SfxDispatcher::FillState_(SfxSlotServer const&, SfxItemSet&, SfxSlot const*) at sfx2/source/control/dispatch.cxx:1657:14 > #5 in SfxBindings::Update_Impl(SfxStateCache&) at sfx2/source/control/bindings.cxx:260:22 > #6 in SfxBindings::NextJob_Impl(Timer const*) at sfx2/source/control/bindings.cxx:1274:17 > #7 in SfxBindings::NextJob(Timer*) at sfx2/source/control/bindings.cxx:1219:5 > #8 in SfxBindings::LinkStubNextJob(void*, Timer*) at sfx2/source/control/bindings.cxx:1217:1 > #9 in Link::Call(Timer*) const at include/tools/link.hxx:111:45 > #10 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21 > #11 in Scheduler::ProcessTaskScheduling() at vcl/source/app/scheduler.cxx:486:20 > #12 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:288:5 > #13 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13

when creating a rectangle in Draw and clicking around in it. Whereas with

Size(-1, -1)

things appear to work fine.

Change-Id: I7368b510113a34fec5c1cabfc35a369cac2fcda1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106187

528a3afa2497 This presumably wants to be Size(-1, -1)
sd/source/ui/view/drviews3.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share