vcl/source/outdev/map.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a1d987cf3d0e1ae4d87f7d06ae93e71a0cc59f0c
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Feb 22 16:24:43 2021 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon Feb 22 21:44:11 2021 +0100

    Fix computation of aF fraction in OutputDevice::SetRelativeMapMode
    
    ...where cfff893b9c82843a90aac4ecdb3a3936721b74a0 "Move unit conversion 
code to
    o3tl, and unify on that in more places" had apparently switched the 
numerator
    and denominator arguments passed into the Fraction constructor.  (And give 
the
    two values returned by o3tl::getConversionMulDiv less misleading names.)
    
    This had caused e.g. UITest_conditional_format
    UITEST_TEST_NAME=tdf100793.tdf100793.test_tdf100793 to fail in a
    (--without-system-cairo) UBSan build with
    
    > cairo-slope-private.h:50:22: runtime error: signed integer overflow: 
-2126627072 - 135139840 cannot be represented in type 'int'
    >  #0 in _cairo_slope_init at 
workdir/UnpackedTarball/cairo/src/./cairo-slope-private.h:50:22
    >  #1 in _cairo_path_fixed_line_to at 
workdir/UnpackedTarball/cairo/src/cairo-path-fixed.c:517:6
    >  #2 in _cairo_default_context_line_to at 
workdir/UnpackedTarball/cairo/src/cairo-default-context.c:715:12
    >  #3 in cairo_line_to at workdir/UnpackedTarball/cairo/src/cairo.c:1743:14
    >  #4 in AddPolygonToPath(_cairo*, basegfx::B2DPolygon const&, 
basegfx::B2DHomMatrix const&, bool, bool) at vcl/headless/svpgdi.cxx:1291:13
    >  #5 in (anonymous namespace)::add_polygon_path(_cairo*, 
basegfx::B2DPolyPolygon const&, basegfx::B2DHomMatrix const&, bool) at 
vcl/headless/svpgdi.cxx:1821:33
    >  #6 in SvpSalGraphics::drawPolyPolygon(basegfx::B2DHomMatrix const&, 
basegfx::B2DPolyPolygon const&, double) at vcl/headless/svpgdi.cxx:1879:9
    >  #7 in SvpSalGraphics::drawRect(long, long, long, long) at 
vcl/headless/svpgdi.cxx:1059:9
    >  #8 in SalGraphics::DrawRect(long, long, long, long, OutputDevice const&) 
at vcl/source/gdi/salgdilayout.cxx:373:5
    >  #9 in OutputDevice::DrawRect(tools::Rectangle const&) at 
vcl/source/outdev/rect.cxx:83:17
    >  #10 in (anonymous namespace)::drawCells(OutputDevice&, 
std::optional<Color> const&, SvxBrushItem const*, std::optional<Color>&, 
SvxBrushItem const*&, tools::Rectangle&, long, long, long, long, ScDataBarInfo 
const*, ScDataBarInfo const*&, ScIconSetInfo const*, ScIconSetInfo const*&, 
std::__debug::map<rtl::OUString, BitmapEx, std::less<rtl::OUString>, 
std::allocator<std::pair<rtl::OUString const, BitmapEx> > >&) at 
sc/source/ui/view/output.cxx:947:32
    >  #11 in ScOutputData::DrawBackground(OutputDevice&) at 
sc/source/ui/view/output.cxx:1116:21
    >  #12 in ScPrintFunc::DrawToDev(ScDocument&, OutputDevice*, double, 
tools::Rectangle const&, ScViewData*, bool) at 
sc/source/ui/view/printfun.cxx:594:17
    >  #13 in ScDocShell::Draw(OutputDevice*, JobSetup const&, unsigned short) 
at sc/source/ui/docshell/docsh4.cxx:2146:9
    >  #14 in SfxObjectShell::DoDraw_Impl(OutputDevice*, Point const&, Fraction 
const&, Fraction const&, JobSetup const&, unsigned short) at 
sfx2/source/doc/objembed.cxx:194:5
    >  #15 in SfxObjectShell::DoDraw(OutputDevice*, Point const&, Size const&, 
JobSetup const&, unsigned short) at sfx2/source/doc/objembed.cxx:141:9
    >  #16 in SfxObjectShell::CreatePreview_Impl(bool, VirtualDevice*, 
GDIMetaFile*) const at sfx2/source/doc/objcont.cxx:199:40
    >  #17 in SfxObjectShell::GetPreviewBitmap() const at 
sfx2/source/doc/objcont.cxx:110:9
    >  #18 in SfxPickListImpl::AddDocumentToPickList(SfxObjectShell const*) at 
sfx2/source/appl/sfxpicklist.cxx:120:46
    >  #19 in SfxPickListImpl::Notify(SfxBroadcaster&, SfxHint const&) at 
sfx2/source/appl/sfxpicklist.cxx:208:13
    >  #20 in SfxBroadcaster::Broadcast(SfxHint const&) at 
svl/source/notify/SfxBroadcaster.cxx:39:24
    >  #21 in (anonymous namespace)::SfxEventAsyncer_Impl::IdleHdl(Timer*) at 
sfx2/source/appl/appcfg.cxx:105:19
    >  #22 in (anonymous 
namespace)::SfxEventAsyncer_Impl::LinkStubIdleHdl(void*, Timer*) at 
sfx2/source/appl/appcfg.cxx:100:1
    >  #23 in Link<Timer*, void>::Call(Timer*) const at 
include/tools/link.hxx:111:45
    >  #24 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21
    >  #25 in Scheduler::ProcessTaskScheduling() at 
vcl/source/app/scheduler.cxx:476:20
    >  #26 in Scheduler::CallbackTaskScheduling() at 
vcl/source/app/scheduler.cxx:266:5
    >  #27 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13
    >  #28 in SvpSalInstance::CheckTimeout(bool) at 
vcl/headless/svpinst.cxx:210:53
    >  #29 in SvpSalInstance::DoYield(bool, bool) at 
vcl/headless/svpinst.cxx:463:21
    >  #30 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:463:48
    >  #31 in Application::Yield() at vcl/source/app/svapp.cxx:530:5
    >  #32 in Application::Execute() at vcl/source/app/svapp.cxx:442:9
    >  #33 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1586:13
    >  #34 in ImplSVMain() at vcl/source/app/svmain.cxx:196:35
    >  #35 in SVMain() at vcl/source/app/svmain.cxx:228:12
    >  #36 in soffice_main at desktop/source/app/sofficemain.cxx:98:12
    >  #37 in sal_main at desktop/source/app/main.c:49:15
    >  #38 in main at desktop/source/app/main.c:47:1
    
    because aF was computed as 2540/1 instead of 1/2540 now.
    
    Change-Id: I092e6afe8cf2ea3145befccf075252b8e09f0967
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111347
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index e899fdc96fa4..78787aef6207 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -673,8 +673,8 @@ void OutputDevice::SetRelativeMapMode( const MapMode& 
rNewMapMode )
         {
             const auto eFrom = MapToO3tlLength(eOld, o3tl::Length::in);
             const auto eTo = MapToO3tlLength(eNew, o3tl::Length::in);
-            const auto& [nNum, nDen] = o3tl::getConversionMulDiv(eFrom, eTo);
-            Fraction aF(nNum, nDen);
+            const auto& [mul, div] = o3tl::getConversionMulDiv(eFrom, eTo);
+            Fraction aF(div, mul);
 
             // a?F =  a?F * aF
             aXF = ImplMakeFraction( aXF.GetNumerator(),   aF.GetNumerator(),
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to