summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-04-11 10:14:37 +0200
committerStephan Bergmann <sbergman@redhat.com>2023-04-11 13:38:04 +0200
commitd1fec382c82f65d49008676525ad7935f8ad9098 (patch)
tree1af3d9fe0ce0db89d081f06fc43254f2dff30976 /oox
parentdd41ea3ec1f579fabb9f674184b52c1be77e2fdb (diff)
Avoid UB converting from double to sal_Int16
...e.g. during CppunitTest_sd_import_tests, > /oox/source/drawingml/colorchoicecontext.cxx:280:78: runtime error: 35000 is outside the range of representable values of type 'short' > #0 0x7f3b8abf6278 in oox::drawingml::ColorValueContext::onCreateContext(int, oox::AttributeList const&) /oox/source/drawingml/colorchoicecontext.cxx:280:78 > #1 0x7f3b8abf6534 in non-virtual thunk to oox::drawingml::ColorValueContext::onCreateContext(int, oox::AttributeList const&) /oox/source/drawingml/colorchoicecontext.cxx > #2 0x7f3b8a94baff in oox::core::ContextHandler2Helper::implCreateChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) /oox/source/core/contexthandler2.cxx:100:34 > #3 0x7f3b8a94eabb in oox::core::ContextHandler2::createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) /oox/source/core/contexthandler2.cxx:204:12 > #4 0x7f3b8a950484 in non-virtual thunk to oox::core::ContextHandler2::createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) /oox/source/core/contexthandler2.cxx > #5 0x7f3b43e81c45 in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:164:67 > #6 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20 > #7 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20 > #8 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20 > #9 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20 > #10 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20 > #11 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20 > #12 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20 > #13 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20 > #14 0x7f3b43df8a50 in DOM::CDocument::fastSaxify(DOM::Context&) /unoxml/source/dom/document.cxx:289:20 > #15 0x7f3b43e117af in DOM::CDocument::fastSerialize(com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastDocumentHandler> const&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastTokenHandler> const&, com::sun::star::uno::Sequence<com::sun::star::beans::StringPair> const&, com::sun::star::uno::Sequence<com::sun::star::beans::Pair<rtl::OUString, int> > const&) /unoxml/source/dom/document.cxx:1023:9 > #16 0x7f3b8aa55f81 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastSAXSerializable> const&) /oox/source/core/xmlfilterbase.cxx:470:23 > #17 0x7f3b8bd30d0f in oox::ppt::PresentationFragmentHandler::importSlide(unsigned int, bool, bool) /oox/source/ppt/presentationfragmenthandler.cxx:357:41 > #18 0x7f3b8bd3cd16 in oox::ppt::PresentationFragmentHandler::finalizeImport() /oox/source/ppt/presentationfragmenthandler.cxx:543:17 > #19 0x7f3b8a9f79ae in oox::core::FragmentHandler2::endDocument() /oox/source/core/fragmenthandler2.cxx:53:5 > #20 0x7f3b548344f0 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:897:36 > #21 0x7f3b54855150 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1469:13 > #22 0x7f3b8a97ff11 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15 > #23 0x7f3b8a9806a8 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5 > #24 0x7f3b8aa548a4 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:412:21 > #25 0x7f3b8aa531fd in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:342:12 > #26 0x7f3b8bcbaf54 in oox::ppt::PowerPointImport::importDocument() /oox/source/ppt/pptimport.cxx:109:17 > #27 0x7f3b8a99493c in oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /oox/source/core/filterbase.cxx:488:49 > #28 0x7f3b8bcbe067 in oox::ppt::PowerPointImport::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /oox/source/ppt/pptimport.cxx:192:24 > #29 0x7f3b7a89c1c6 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sfx2/source/doc/objstor.cxx:2272:34 > #30 0x7f3b82834e18 in sd::DrawDocShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sd/source/ui/docshell/docshel4.cxx:429:39 > #31 0x7f3b7a85bd64 in SfxObjectShell::DoLoad(SfxMedium*) /sfx2/source/doc/objstor.cxx:739:23 > #32 0x7f3b7aa63c10 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1940:36 > #33 0x7f3b7b1c142c in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) /sfx2/source/view/frmload.cxx:720:28 > #34 0x7f3b4ff0f5fb in framework::LoadEnv::impl_loadContent() /framework/source/loadenv/loadenv.cxx:1176:37 > #35 0x7f3b4ff059fb in framework::LoadEnv::start() /framework/source/loadenv/loadenv.cxx:412:20 > #36 0x7f3b4fefd8bc in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) /framework/source/loadenv/loadenv.cxx:308:5 > #37 0x7f3b4fef8c50 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/loadenv/loadenv.cxx:168:14 > #38 0x7f3b4ffc334d in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx:593:16 > #39 0x7f3b4ffc3576 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx > #40 0x7f3b5feedd95 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:71:62 > #41 0x7f3b75b0aef9 in UnoApiTest::load(rtl::OUString const&, char const*) /test/source/unoapi_test.cxx:115:11 > #42 0x7f3b75b0baf4 in UnoApiTest::loadFromURL(std::basic_string_view<char16_t, std::char_traits<char16_t> >, char const*) /test/source/unoapi_test.cxx:127:5 > #43 0x7f3b95d2f402 in SdModelTestBase::createSdImpressDoc(char const*, char const*) /sd/qa/unit/sdmodeltestbase.hxx:54:13 > #44 0x7f3b95d025c8 in testBnc584721_1::TestBody() /sd/qa/unit/import-tests.cxx:1281:5 (<https://ci.libreoffice.org/job/lo_ubsan/2741/>). Presumably it was just a typo that f707834e8538c0a183716b26ebdf04381482ca6d "oox: write color transforms to model::ColorDefinition" used 10.0 rather than 10 as divisor. Change-Id: I42de6daaa6db86bf4444243ec2c9173d6d514b02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150216 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/colorchoicecontext.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx
index 927ff41de9c0..1ee6b9afacad 100644
--- a/oox/source/drawingml/colorchoicecontext.cxx
+++ b/oox/source/drawingml/colorchoicecontext.cxx
@@ -277,7 +277,7 @@ void ColorValueContext::onStartElement( const AttributeList& rAttribs )
else
nValue = rAttribs.getInteger(XML_val, 0);
- mpColorDefinition->maTransformations.push_back({eType, sal_Int16(nValue / 10.0)});
+ mpColorDefinition->maTransformations.push_back({eType, sal_Int16(nValue / 10)});
}
}