summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-10-10 13:30:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-10-10 13:34:39 +0200
commita636217f1fed882ef820540833d9283796b00380 (patch)
tree384ac7a86468bca2cd4aad6a5365dca2934aff67 /xmloff
parent53c836701e22b1babd3702b502facd76236df7ff (diff)
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
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index db5fc9edc979..1ccc56cea869 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() );
}
}