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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 12 23:06:38 UTC 2018


 sc/source/core/tool/interpr4.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 32d846dc84c8ab5bf947ab3e20f353bf403372eb
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Nov 12 19:42:57 2018 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Nov 13 00:06:15 2018 +0100

    Silence -fsanitize=implicit-signed-integer-truncation
    
    ...as happens during CppunitTest_sc_logical_functions_test (see below), by not
    relying on wrap-around of
    
      nStackBase = sp - pCur->GetParamCount();
    
    during underflow.  (Though I have no idea whether the excited "underflow?!?"
    comment means that underflow is indeed expected and harmless, or rather
    indicates a severe problem elsewhere; at least, it does happen during
    CppunitTest_sc_logical_functions_test as shown below).
    
    > sc/source/core/tool/interpr4.cxx:3965:34: runtime error: implicit conversion from type 'int' of value -2 (32-bit, signed) to type 'sal_uInt16' (aka 'unsigned short') changed the value to 65534 (16-bit, unsigned)
    >  #0 in ScInterpreter::Interpret() at sc/source/core/tool/interpr4.cxx:3965:34 (instdir/program/libsclo.so +0xab8f35e)
    >  #1 in ScFormulaCell::InterpretTail(ScInterpreterContext&, ScFormulaCell::ScInterpretTailParameter) at sc/source/core/data/formulacell.cxx:1866:23 (instdir/program/libsclo.so +0x9bce713)
    >  #2 in ScFormulaCell::Interpret() at sc/source/core/data/formulacell.cxx:1577:13 (instdir/program/libsclo.so +0x9bc4611)
    >  #3 in ScFormulaCell::MaybeInterpret() at sc/source/core/data/formulacell.cxx:2673:9 (instdir/program/libsclo.so +0x9bb04f0)
    >  #4 in ScFormulaCell::GetErrCode() at sc/source/core/data/formulacell.cxx:2912:5 (instdir/program/libsclo.so +0x9beab05)
    >  #5 in ScCellFormat::GetString(ScRefCellValue&, unsigned int, rtl::OUString&, Color**, SvNumberFormatter&, ScDocument const*, bool, bool, bool) at sc/source/core/tool/cellform.cxx:79:59 (instdir/program/libsclo.so +0xa42272b)
    >  #6 in ScColumn::UpdateScriptType(sc::CellTextAttr&, int, mdds::detail::mtv::iterator_base<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::iterator_trait, mdds::detail::mtv::private_data_forward_update<mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block> > >&) at sc/source/core/data/column3.cxx:534:5 (instdir/program/libsclo.so +0x8b81f94)
    >  #7 in ScColumn::GetRangeScriptType(mdds::detail::mtv::iterator_base<mdds::multi_type_vector<mdds::mtv::custom_block_func1<mdds::mtv::default_element_block<51, sc::CellTextAttr> >, mdds::detail::mtv::event_func>::iterator_trait, mdds::detail::mtv::private_data_forward_update<mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block> > >&, int, int, mdds::detail::mtv::iterator_base<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::iterator_trait, mdds::detail::mtv::private_data_forward_update<mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block> > > const&) at sc/source/core/data/column2.cxx:2010:17 (instdir/program/libsclo.so +0x8aa4973)
    >  #8 in (anonymous namespace)::FindEditCellsHandler::operator()(unsigned long, ScFormulaCell const*) at sc/source/core/data/column.cxx:3036:46 (instdir/program/libsclo.so +0x8873d9b)
    >  #9 in std::pair<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::const_iterator, unsigned long> sc::CheckElem<mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>, mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>, (anonymous namespace)::FindEditCellsHandler>(mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent> const&, mdds::multi_type_v
 ector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::const_iterator const&, unsigned long, unsigned long, (anonymous namespace)::FindEditCellsHandler&) at sc/inc/mtvfunctions.hxx:139:13 (instdir/program/libsclo.so +0x8872c89)
    >  #10 in std::pair<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::const_iterator, mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::size_type> sc::FindElement2<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>, (ano
 nymous namespace)::FindEditCellsHandler, (anonymous namespace)::FindEditCellsHandler>(mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent> const&, mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::size_type, mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::size_type, (anonymous namespace)::FindEditCellsHandler&, (anonymous namespace)::FindEditCellsHandl
 er&) at sc/inc/mtvfunctions.hxx:464:37 (instdir/program/libsclo.so +0x88710f5)
    >  #11 in std::pair<mdds::detail::mtv::const_iterator_base<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::const_iterator_trait, mdds::detail::mtv::private_data_forward_update<mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block> >, mdds::detail::mtv::iterator_base<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::iterator_trait, mdds::detail::mtv::private_data_forward_update<mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block> > > >, unsigned long> sc::FindFormulaEditText<(anonymous namespace)
 ::FindEditCellsHandler>(mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent> const&, int, int, (anonymous namespace)::FindEditCellsHandler&) at sc/inc/mtvcellfunc.hxx:139:12 (instdir/program/libsclo.so +0x8827df0)
    >  #12 in ScColumn::HasEditCells(int, int, int&) at sc/source/core/data/column.cxx:3510:9 (instdir/program/libsclo.so +0x88275b3)
    >  #13 in ScColumn::GetOptimalHeight(sc::RowHeightContext&, int, int, unsigned short, int) at sc/source/core/data/column2.cxx:823:38 (instdir/program/libsclo.so +0x8aa0056)
    >  #14 in (anonymous namespace)::GetOptimalHeightsInColumn(sc::RowHeightContext&, ScColContainer&, int, int, ScProgress*, unsigned long) at sc/source/core/data/table1.cxx:115:20 (instdir/program/libsclo.so +0x9fb52dd)
    >  #15 in ScTable::SetOptimalHeight(sc::RowHeightContext&, int, int, ScProgress*, unsigned long) at sc/source/core/data/table1.cxx:474:5 (instdir/program/libsclo.so +0x9fb4073)
    >  #16 in ScDocRowHeightUpdater::update() at sc/source/core/data/dociter.cxx:2576:33 (instdir/program/libsclo.so +0x8f17a78)
    >  #17 in ScXMLImport::endDocument() at sc/source/filter/xml/xmlimprt.cxx:1806:22 (instdir/program/libsclo.so +0xbd59796)
    >  #18 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:876:36 (instdir/program/libexpwraplo.so +0x237ebc)
    >  #19 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:1377:13 (instdir/program/libexpwraplo.so +0x2528ab)
    >  #20 in SvXMLImport::parseStream(com::sun::star::xml::sax::InputSource const&) at xmloff/source/core/xmlimp.cxx:484:15 (instdir/program/libxolo.so +0x261ef9d)
    >  #21 in filter::odfflatxml::OdfFlatXml::importer(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XDocumentHandler> const&, com::sun::star::uno::Sequence<rtl::OUString> const&) at filter/source/odfflatxml/OdfFlatXml.cxx:151:26 (instdir/program/libodfflatxmllo.so +0x218fa)
    >  #22 in XmlFilterAdaptor::importImpl(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx:180:26 (instdir/program/libxmlfalo.so +0x3ee1f)
    >  #23 in XmlFilterAdaptor::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx:316:67 (instdir/program/libxmlfalo.so +0x44f0a)
    >  #24 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sfx2/source/doc/objstor.cxx:2251:34 (instdir/program/libsfxlo.so +0x38d597f)
    >  #25 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:772:23 (instdir/program/libsfxlo.so +0x389eaf9)
    >  #26 in ScBootstrapFixture::load(bool, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned long, rtl::OUString const*) at sc/qa/unit/helper/qahelper.cxx:582:21 (workdir/LinkTarget/CppunitTest/../Library/libscqahelper.so +0x869b5)
    >  #27 in ScBootstrapFixture::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned long, rtl::OUString const*) at sc/qa/unit/helper/qahelper.cxx:597:12 (workdir/LinkTarget/CppunitTest/../Library/libscqahelper.so +0x86fa6)
    >  #28 in FunctionsTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sc/qa/unit/functions_test.cxx:35:51 (workdir/LinkTarget/CppunitTest/../Library/libscqahelper.so +0xe4e95)
    >  #29 in non-virtual thunk to FunctionsTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sc/qa/unit/functions_test.cxx (workdir/LinkTarget/CppunitTest/../Library/libscqahelper.so +0xe59db)
    >  #30 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:130:20 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x7526d)
    >  #31 in LogicalFunctionsTest::testLogicalFormulasFODS() at sc/qa/unit/functions_logical.cxx:19:5 (workdir/LinkTarget/CppunitTest/libtest_sc_logical_functions_test.so +0x1fd60)
    [...]
    
    Change-Id: Icccfb37c33885d72bff1003b3a8f8505850eb184
    Reviewed-on: https://gerrit.libreoffice.org/63302
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 3bb3cf83c350..070510deb1f6 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3961,11 +3961,11 @@ StackVar ScInterpreter::Interpret()
                     eOp = ocNone;       // JumpMatrix created
                     nStackBase = sp;
                 }
-                else
+                else if (sp >= pCur->GetParamCount())
                     nStackBase = sp - pCur->GetParamCount();
+                else
+                    nStackBase = sp;    // underflow?!?
             }
-            if ( nStackBase > sp )
-                nStackBase = sp;        // underflow?!?
 
             switch( eOp )
             {


More information about the Libreoffice-commits mailing list