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

Stephan Bergmann sbergman at redhat.com
Fri Oct 10 04:35:25 PDT 2014


 xmloff/source/chart/SchXMLExport.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit a636217f1fed882ef820540833d9283796b00380
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 10 13:30:52 2014 +0200

    UBSan runtime error: division by zero
    
    ...triggered by CppunitTest_sw_ooxmlexport.
    
    Though it iss unclear to me what is the best fix in this case, emit a
    style:legend-expansion-aspect-ratio value of 1, emit a style:legend-expansion
    value of "custom" without an accompanying style:legend-expansion-aspect-ratio
    (if that is even valid), emit another style:legend-expansion value, or emit no
    style:legend-expansion attribute (if that is even valid)?
    
    Change-Id: I36afe35082a841974bb2480fe11a7a3dd815ddf0

diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index db5fc9e..1ccc56c 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -1434,7 +1434,9 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >&
                                 OUStringBuffer aAspectRatioString;
                                 ::sax::Converter::convertDouble(
                                     aAspectRatioString,
-                                    double(aSize.Width)/double(aSize.Height));
+                                    (aSize.Height == 0
+                                     ? 1.0
+                                     : double(aSize.Width)/double(aSize.Height)));
                                 mrExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION_ASPECT_RATIO, aAspectRatioString.makeStringAndClear() );
                             }
                         }


More information about the Libreoffice-commits mailing list