Avoid overflowing sal_Int16 PROP_GRID_LINES

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 5 March 2019 07:57 EST

...as seen with Clang's -fsanitize=implicit-signed-integer-truncation during CppunitTest_sw_ooxmlexport4 when nTextAreaHeight=36920 and m_nGridLinePitch=1:

> writerfilter/source/dmapper/PropertyMap.cxx:1519:38: runtime error: implicit conversion from type 'int' of value 36920 (32-bit, signed) to type 'const sal_Int16' (aka 'const short') changed the value to -28616 (16-bit, signed) > #0 in writerfilter::dmapper::SectionPropertyMap::CloseSectionGroup(writerfilter::dmapper::DomainMapper_Impl&) at writerfilter/source/dmapper/PropertyMap.cxx:1519:38 > #1 in writerfilter::dmapper::DomainMapper::lcl_endSectionGroup() at writerfilter/source/dmapper/DomainMapper.cxx:2881:30 > #2 in writerfilter::LoggedStream::endSectionGroup() at writerfilter/source/dmapper/LoggedResources.cxx:101:5 > #3 in writerfilter::ooxml::OOXMLFastContextHandler::endSectionGroup() at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:434:23 > #4 in writerfilter::ooxml::OOXMLFactory_wml::endAction(writerfilter::ooxml::OOXMLFastContextHandler*) at workdir/CustomTarget/writerfilter/source/ooxml/OOXMLFactory_wml.cxx:7517:19 > #5 in writerfilter::ooxml::OOXMLFactory::endAction(writerfilter::ooxml::OOXMLFastContextHandler*) at writerfilter/source/ooxml/OOXMLFactory.cxx:199:19 > #6 in writerfilter::ooxml::OOXMLFastContextHandler::lcl_endFastElement(int) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:195:5 > #7 in writerfilter::ooxml::OOXMLFastContextHandler::endFastElement(int) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:177:9 > #8 in (anonymous namespace)::Entity::endElement() at sax/source/fastparser/fastparser.cxx:483:27 > #9 in sax_fastparser::FastSaxParserImpl::callbackEndElement() at sax/source/fastparser/fastparser.cxx:1274:17 > #10 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) at sax/source/fastparser/fastparser.cxx:310:18 > #11 in xmlParseEndTag2 at workdir/UnpackedTarball/libxml2/parser.c:9680:2 > #12 in xmlParseTryOrFinish at workdir/UnpackedTarball/libxml2/parser.c:11531:7 > #13 in xmlParseChunk__internal_alias at workdir/UnpackedTarball/libxml2/parser.c:12244:13 > #14 in sax_fastparser::FastSaxParserImpl::parse() at sax/source/fastparser/fastparser.cxx:1043:21 > #15 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:863:9 > #16 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:1359:13 > #17 in writerfilter::ooxml::OOXMLDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:504:22 > #18 in WriterFilter::filter(com::sun::star::uno::Sequence const&) at writerfilter/source/filter/WriterFilter.cxx:192:24 > #19 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference const&) at sfx2/source/doc/objstor.cxx:2212:34 > #20 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:741:23 > #21 in SfxBaseModel::load(com::sun::star::uno::Sequence const&) at sfx2/source/doc/sfxbasemodel.cxx:1844:36 > #22 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) at sfx2/source/view/frmload.cxx:689:28 > #23 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1150:37 > #24 in framework::LoadEnv::startLoading() at framework/source/loadenv/loadenv.cxx:384:20 > #25 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) at framework/source/loadenv/loadenv.cxx:170:14 > #26 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) at framework/source/services/desktop.cxx:619:12 > #27 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) at framework/source/services/desktop.cxx > #28 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence const&) at unotest/source/cpp/macros_test.cxx:50:60 > #29 in SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) at sw/qa/extras/inc/swmodeltestbase.hxx:761:23 > #30 in SwModelTestBase::load(rtl::OUString const&, char const*, char const*) at sw/qa/extras/inc/swmodeltestbase.hxx:716:16 > #31 in SwModelTestBase::executeImportTest(char const*, char const*) at sw/qa/extras/inc/swmodeltestbase.hxx:264:13 > #32 in testTdf86926_A3::Import() at sw/qa/extras/ooxmlexport/ooxmlexport4.cxx:1140:1 [...]

Change-Id: Idf694b0dda871f1313d36c03764b0199e10d1b25 Reviewed-on: https://gerrit.libreoffice.org/68710

04073c7a7cd5 Avoid overflowing sal_Int16 PROP_GRID_LINES
writerfilter/source/dmapper/PropertyMap.cxx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Upstream: cgit.freedesktop.org


  • Share