From 3dabb0692d496684ba145cc95884a731ca1cd5b0 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 31 Aug 2015 18:12:55 +0200 Subject: -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 --- sd/source/core/sdpage.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sd') diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index cce381738bae..9caab81a83bb 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; -- cgit