[Libreoffice-commits] core.git: sd/source

Stephan Bergmann sbergman at redhat.com
Mon Aug 31 09:17:02 PDT 2015


 sd/source/core/sdpage.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 3dabb0692d496684ba145cc95884a731ca1cd5b0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Aug 31 18:12:55 2015 +0200

    -fsanitize=float-divide-by-zero
    
    ...as happens in CppunitTest_sd_filters_test with
    sd/qa/unit/data/ppt/pass/hang-16.ppt:
    
    > sd/source/core/sdpage.cxx:1101:57: runtime error: division by zero
    >  SdPage::GetTitleRect() const sd/source/core/sdpage.cxx:1101:57
    >  CalcAutoLayoutRectangles(SdPage&, Rectangle*, rtl::OUString const&) sd/source/core/sdpage.cxx:1323:26
    >  SdPage::SetAutoLayout(AutoLayout, bool, bool) sd/source/core/sdpage.cxx:1595:5
    >  ImplSdPPTImport::Import() sd/source/filter/ppt/pptin.cxx:1025:21
    >  SdPPTImport::Import() sd/source/filter/ppt/pptin.cxx:161:12
    >  ImportPPT sd/source/filter/ppt/pptin.cxx:2744:17
    >  SdPPTFilter::Import() sd/source/filter/sdpptwrp.cxx:108:32
    >  sd::DrawDocShell::ConvertFrom(SfxMedium&) sd/source/ui/docshell/docshel4.cxx:453:16
    >  SfxObjectShell::DoLoad(SfxMedium*) sfx2/source/doc/objstor.cxx:790:23
    >  SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) sd/qa/unit/filters-test.cxx:75:20
    
    Change-Id: Ic6a339c0315e9bc3f28de8c26c3d9f2767c3509d

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index cce3817..9caab81 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1098,8 +1098,10 @@ Rectangle SdPage::GetTitleRect() const
             if ( pRefPage )
             {
                 // scale actually page size into handout rectangle
-                double fH = (double) aPartArea.Width()  / pRefPage->GetWdt();
-                double fV = (double) aPartArea.Height() / pRefPage->GetHgt();
+                double fH = pRefPage->GetWdt() == 0
+                    ? 0 : (double) aPartArea.Width()  / pRefPage->GetWdt();
+                double fV = pRefPage->GetHgt() == 0
+                    ? 0 : (double) aPartArea.Height() / pRefPage->GetHgt();
 
                 if ( fH > fV )
                     fH = fV;


More information about the Libreoffice-commits mailing list