[Libreoffice-commits] core.git: vcl/headless

Stephan Bergmann sbergman at redhat.com
Wed Apr 6 10:29:23 UTC 2016


 vcl/headless/svpgdi.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 3131621b7901056a3d6e43f4869bccaa21b17923
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Apr 6 12:28:17 2016 +0200

    Avoid division by zero
    
    At least JunitTest_framework_copmlex triggered the UBSan failure
    
    > vcl/headless/svpgdi.cxx:924:46: runtime error: division by zero
    >     #0 0x2b7114500e3b in renderSource(_cairo*, SalTwoRect const&, _cairo_surface*) vcl/headless/svpgdi.cxx:924:46
    >     #1 0x2b711450074c in SvpSalGraphics::copySource(SalTwoRect const&, _cairo_surface*) vcl/headless/svpgdi.cxx:937:33
    >     #2 0x2b7114501f37 in SvpSalGraphics::copyBits(SalTwoRect const&, SalGraphics*) vcl/headless/svpgdi.cxx:980:5
    >     #3 0x2b7113461871 in SalGraphics::CopyBits(SalTwoRect const&, SalGraphics*, OutputDevice const*, OutputDevice const*) vcl/source/gdi/salgdilayout.cxx:529:9
    >     #4 0x2b711359a1fc in VirtualDevice::InnerImplSetOutputSizePixel(Size const&, bool, unsigned char*) vcl/source/gdi/virdev.cxx:352:17
    >     #5 0x2b711359bef6 in VirtualDevice::ImplSetOutputSizePixel(Size const&, bool, unsigned char*) vcl/source/gdi/virdev.cxx:391:9
    >     #6 0x2b711359edc0 in VirtualDevice::SetOutputSizePixel(Size const&, bool) vcl/source/gdi/virdev.cxx:437:12
    >     #7 0x2b70fa4b6f3f in sdr::overlay::OverlayManagerBuffered::ImpPrepareBufferDevice() svx/source/sdr/overlay/overlaymanagerbuffered.cxx:45:17
    >     #8 0x2b70fa4c0c2c in sdr::overlay::OverlayManagerBuffered::ImpSaveBackground(vcl::Region const&, OutputDevice*) svx/source/sdr/overlay/overlaymanagerbuffered.cxx:159:13
    >     #9 0x2b70fa4cecab in sdr::overlay::OverlayManagerBuffered::completeRedraw(vcl::Region const&, OutputDevice*) const svx/source/sdr/overlay/overlaymanagerbuffered.cxx:414:17
    >     #10 0x2b70fa787fc4 in SdrPaintWindow::DrawOverlay(vcl::Region const&) svx/source/svdraw/sdrpaintwindow.cxx:334:13
    >     #11 0x2b70fb9d388f in SdrPaintView::EndCompleteRedraw(SdrPaintWindow&, bool) svx/source/svdraw/svdpntv.cxx:753:9
    >     #12 0x2b70fd77da81 in FmFormView::EndCompleteRedraw(SdrPaintWindow&, bool) svx/source/form/fmview.cxx:474:5
    >     #13 0x2b70fb9d64a0 in SdrPaintView::EndDrawLayers(SdrPaintWindow&, bool) svx/source/svdraw/svdpntv.cxx:789:5
    >     #14 0x2b7182085fe9 in SwViewShell::DLPostPaint2(bool) sw/source/core/view/viewsh.cxx:240:9
    >     #15 0x2b71820d94c5 in SwViewShell::Paint(OutputDevice&, Rectangle const&) sw/source/core/view/viewsh.cxx:1797:21
    >     #16 0x2b717c26e635 in SwCursorShell::Paint(OutputDevice&, Rectangle const&) sw/source/core/crsr/crsrsh.cxx:1273:5
    >     #17 0x2b71839ae182 in SwEditWin::Paint(OutputDevice&, Rectangle const&) sw/source/uibase/docvw/edtwin2.cxx:475:9
    >     #18 0x2b71100ee7e0 in PaintHelper::DoPaint(vcl::Region const*) vcl/source/window/paint.cxx:309:13
    >     #19 0x2b71100ff14a in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:611:9
    >     #20 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
    >     #21 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
    >     #22 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
    >     #23 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
    >     #24 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
    >     #25 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
    >     #26 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
    >     #27 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
    >     #28 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
    >     #29 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
    >     #30 0x2b7110100536 in vcl::Window::ImplCallOverlapPaint() vcl/source/window/paint.cxx:635:9
    >     #31 0x2b7110102811 in vcl::Window::ImplHandlePaintHdl(Idle*) vcl/source/window/paint.cxx:667:9
    >     #32 0x2b7110100ee7 in vcl::Window::LinkStubImplHandlePaintHdl(void*, Idle*) vcl/source/window/paint.cxx:645:1
    >     #33 0x2b71101446d7 in Link<Idle*, void>::Call(Idle*) const include/tools/link.hxx:84:45
    >     #34 0x2b711380dff9 in Idle::Invoke() vcl/source/app/idle.cxx:25:5
    >     #35 0x2b711385011b in ImplSchedulerData::Invoke() vcl/source/app/scheduler.cxx:45:5
    >     #36 0x2b71138535e5 in Scheduler::ProcessTaskScheduling(bool) vcl/source/app/scheduler.cxx:177:9
    >     #37 0x2b71139a90d4 in ImplYield(bool, bool, unsigned long) vcl/source/app/svapp.cxx:521:5
    >     #38 0x2b7113982d83 in Application::Yield() vcl/source/app/svapp.cxx:553:5
    >     #39 0x2b7113982b1a in Application::Execute() vcl/source/app/svapp.cxx:473:9
    >     #40 0x2b70df7a4294 in desktop::Desktop::DoExecute() desktop/source/app/app.cxx:1322:5
    >     #41 0x2b70df7aeda3 in desktop::Desktop::Main() desktop/source/app/app.cxx:1647:17
    >     #42 0x2b7113a0208e in ImplSVMain() vcl/source/app/svmain.cxx:172:19
    >     #43 0x2b7113a0f776 in SVMain() vcl/source/app/svmain.cxx:210:16
    >     #44 0x2b70df9e9d01 in soffice_main desktop/source/app/sofficemain.cxx:135:12
    >     #45 0x4f0f0c in sal_main desktop/source/app/main.c:48:15
    >     #46 0x4f0ee6 in main desktop/source/app/main.c:47:1
    >     #47 0x2b70e137057f in __libc_start_main (/lib64/libc.so.6+0x2057f)
    >     #48 0x418f48 in _start (instdir/program/soffice.bin+0x418f48)
    
    Change-Id: I2bc4abe48c129e006582b9870229f44d2d2bb1ed

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index e1292ce..e878113 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -921,7 +921,9 @@ static basegfx::B2DRange renderSource(cairo_t* cr, const SalTwoRect& rTR,
     cairo_clip(cr);
 
     cairo_translate(cr, rTR.mnDestX, rTR.mnDestY);
-    cairo_scale(cr, (double)(rTR.mnDestWidth)/rTR.mnSrcWidth, ((double)rTR.mnDestHeight)/rTR.mnSrcHeight);
+    if (rTR.mnSrcWidth != 0 && rTR.mnSrcHeight != 0) {
+        cairo_scale(cr, (double)(rTR.mnDestWidth)/rTR.mnSrcWidth, ((double)rTR.mnDestHeight)/rTR.mnSrcHeight);
+    }
     cairo_set_source_surface(cr, source, -rTR.mnSrcX, -rTR.mnSrcY);
     cairo_paint(cr);
 


More information about the Libreoffice-commits mailing list