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

Stephan Bergmann sbergman at redhat.com
Tue Apr 18 15:06:31 UTC 2017


 basic/source/inc/runtime.hxx     |    3 ++-
 basic/source/runtime/runtime.cxx |   10 ++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 24fa0d64b62ddca20bef224e7e47aa45afd67665
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 18 17:01:30 2017 +0200

    Call implHandleSbxFlags also from StepSTATIC_Impl
    
    ...similarly to how it is called from StepLOCAL and StepPUBLIC_Impl.
    
    Now that there's basic/qa/vba_tests/mirr.vb containing
    
        Static Values(5) As Double    ' Set up array.
    
    that caused CppunitTest_basic_macros to fail in UBSan builds with
    
    > /basic/source/runtime/runtime.cxx:4613:34: runtime error: load of value 262149, which is not a valid value for type 'SbxDataType'
    >     #0 0x2b25aa72d3f5 in SbiRuntime::StepSTATIC_Impl(rtl::OUString&, SbxDataType&) /basic/source/runtime/runtime.cxx:4613:34
    >     #1 0x2b25aa6e821f in SbiRuntime::StepSTATIC(unsigned int, unsigned int) /basic/source/runtime/runtime.cxx:4629:5
    >     #2 0x2b25aa6ff0cf in SbiRuntime::Step() /basic/source/runtime/runtime.cxx:770:13
    >     #3 0x2b25aa237cba in SbModule::Run(SbMethod*) /basic/source/classes/sbxmod.cxx:1144:20
    >     #4 0x2b25aa232916 in SbModule::Notify(SfxBroadcaster&, SfxHint const&) /basic/source/classes/sbxmod.cxx:809:21
    >     #5 0x2b259b0f51f1 in SfxBroadcaster::Broadcast(SfxHint const&) /svl/source/notify/SfxBroadcaster.cxx:49:13
    >     #6 0x2b25aa267165 in SbMethod::Broadcast(SfxHintId) /basic/source/classes/sbxmod.cxx:2126:9
    >     #7 0x2b25aaa96fb9 in SbxValue::SbxValue(SbxValue const&) /basic/source/sbx/sbxvalue.cxx:62:9
    >     #8 0x2b25aaae16ec in SbxVariable::SbxVariable(SbxVariable const&) /basic/source/sbx/sbxvar.cxx:73:7
    >     #9 0x2b25aaa51afd in SbxMethod::SbxMethod(SbxMethod const&) /basic/source/sbx/sbxobj.cxx:869:7
    >     #10 0x2b25aa72c12b in SbiRuntime::FindElement(SbxObject*, unsigned int, unsigned int, unsigned long, bool, bool) /basic/source/runtime/runtime.cxx:3518:37
    >     #11 0x2b25aa735314 in SbiRuntime::StepFIND_Impl(SbxObject*, unsigned int, unsigned int, unsigned long, bool) /basic/source/runtime/runtime.cxx:3941:14
    >     #12 0x2b25aa6da643 in SbiRuntime::StepFIND(unsigned int, unsigned int) /basic/source/runtime/runtime.cxx:3947:5
    >     #13 0x2b25aa6ff0cf in SbiRuntime::Step() /basic/source/runtime/runtime.cxx:770:13
    >     #14 0x2b25aa237cba in SbModule::Run(SbMethod*) /basic/source/classes/sbxmod.cxx:1144:20
    >     #15 0x2b25aa232916 in SbModule::Notify(SfxBroadcaster&, SfxHint const&) /basic/source/classes/sbxmod.cxx:809:21
    >     #16 0x2b259b0f51f1 in SfxBroadcaster::Broadcast(SfxHint const&) /svl/source/notify/SfxBroadcaster.cxx:49:13
    >     #17 0x2b25aa267165 in SbMethod::Broadcast(SfxHintId) /basic/source/classes/sbxmod.cxx:2126:9
    >     #18 0x2b25aaa96fb9 in SbxValue::SbxValue(SbxValue const&) /basic/source/sbx/sbxvalue.cxx:62:9
    >     #19 0x2b25aaae16ec in SbxVariable::SbxVariable(SbxVariable const&) /basic/source/sbx/sbxvar.cxx:73:7
    >     #20 0x2b25aaa51afd in SbxMethod::SbxMethod(SbxMethod const&) /basic/source/sbx/sbxobj.cxx:869:7
    >     #21 0x2b25a9010a4a in MacroSnippet::Run(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) /basic/qa/cppunit/basictest.cxx:95:23
    >     #22 0x2b25a9012797 in MacroSnippet::Run() /basic/qa/cppunit/basictest.cxx:103:12
    >     #23 0x2b25a908e336 in (anonymous namespace)::VBATest::testMiscVBAFunctions() /basic/qa/cppunit/test_vba.cxx:125:34
    >     #24 0x2b25a90964a8 in void std::_Mem_fn_base<void ((anonymous namespace)::VBATest::*)(), true>::operator()<, void>((anonymous namespace)::VBATest*) const /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:600:11
    >     #25 0x2b25a90961d3 in void std::_Bind<std::_Mem_fn<void ((anonymous namespace)::VBATest::*)()> ((anonymous namespace)::VBATest*)>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:1073:11
    >     #26 0x2b25a9095c81 in void std::_Bind<std::_Mem_fn<void ((anonymous namespace)::VBATest::*)()> ((anonymous namespace)::VBATest*)>::operator()<, void>() /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:1131:11
    >     #27 0x2b25a9094a79 in std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void ((anonymous namespace)::VBATest::*)()> ((anonymous namespace)::VBATest*)> >::_M_invoke(std::_Any_data const&) /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:1871:2
    >     #28 0x2b25a9046710 in std::function<void ()>::operator()() const /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:2271:14
    >     #29 0x2b25a9093175 in CppUnit::TestCaller<(anonymous namespace)::VBATest>::runTest() /workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7
    >     #30 0x2b256430d0ad in CppUnit::TestCaseMethodFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
    >     #31 0x2b257d507ea6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /test/source/vclbootstrapprotector.cxx:39:14
    >     #32 0x2b25642cbb77 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12
    >     #33 0x2b2573b757f6 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
    >     #34 0x2b25642cbb77 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12
    >     #35 0x2b256fd37d83 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16
    >     #36 0x2b25642cbb77 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12
    >     #37 0x2b256424750f in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
    >     #38 0x2b25642cbb77 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12
    >     #39 0x2b25642c1da0 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18
    >     #40 0x2b2564396efb in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::string const&) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:182:10
    >     #41 0x2b256430a12d in CppUnit::TestCase::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:5
    >     #42 0x2b25643102e3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:5
    >     #43 0x2b256430f24d in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
    >     #44 0x2b25643102e3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:5
    >     #45 0x2b256430f24d in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
    >     #46 0x2b25643d68b6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:5
    >     #47 0x2b2564395049 in CppUnit::TestResult::runTest(CppUnit::Test*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:3
    >     #48 0x2b25643d7d57 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::string const&) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:3
    >     #49 0x5161f2 in (anonymous namespace)::ProtectedFixtureFunctor::run() const /sal/cppunittester/cppunittester.cxx:306:13
    >     #50 0x510c8f in sal_main() /sal/cppunittester/cppunittester.cxx:456:14
    >     #51 0x50eda2 in main /sal/cppunittester/cppunittester.cxx:363:1
    >     #52 0x2b2565ff6b14 in __libc_start_main (/lib64/libc.so.6+0x21b14)
    >     #53 0x433a04 in _start (/workdir/LinkTarget/Executable/cppunittester+0x433a04)
    
    (where 262149 = 0x40005, i.e., SbxDOUBLE|SBX_TYPE_VAR_TO_DIM_FLAG)
    
    Change-Id: Ib35a5c66c9b3266c13616f4cb896d533378a8eb0

diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 1b11dcd02ffe..db3b835cb5bd 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -337,7 +337,8 @@ class SbiRuntime
     void StepPARAM( sal_uInt32, sal_uInt32),    StepCREATE( sal_uInt32, sal_uInt32 );
     void StepCALL( sal_uInt32, sal_uInt32 ),    StepCALLC( sal_uInt32, sal_uInt32 );
     void StepCASEIS( sal_uInt32, sal_uInt32 ),  StepSTMNT( sal_uInt32, sal_uInt32 );
-    SbxVariable* StepSTATIC_Impl( OUString& aName, SbxDataType& t );
+    SbxVariable* StepSTATIC_Impl(
+        OUString& aName, SbxDataType& t, sal_uInt32 nOp2 );
     void StepOPEN( sal_uInt32, sal_uInt32 ),    StepSTATIC( sal_uInt32, sal_uInt32 );
     void StepTCREATE(sal_uInt32,sal_uInt32),    StepDCREATE(sal_uInt32,sal_uInt32);
     void StepGLOBAL_P( sal_uInt32, sal_uInt32 ),StepFIND_G( sal_uInt32, sal_uInt32 );
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 5e4e5f299559..f4b7c38194cf 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -3466,7 +3466,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt
                 {
                     if ( bStatic )
                     {
-                        pElem = StepSTATIC_Impl( aName, t );
+                        pElem = StepSTATIC_Impl( aName, t, 0 );
                     }
                     if ( !pElem )
                     {
@@ -4602,7 +4602,8 @@ void SbiRuntime::StepFIND_G( sal_uInt32 nOp1, sal_uInt32 nOp2 )
 }
 
 
-SbxVariable* SbiRuntime::StepSTATIC_Impl( OUString& aName, SbxDataType& t )
+SbxVariable* SbiRuntime::StepSTATIC_Impl(
+    OUString& aName, SbxDataType& t, sal_uInt32 nOp2 )
 {
     SbxVariable* p = nullptr;
     if ( pMeth )
@@ -4616,6 +4617,7 @@ SbxVariable* SbiRuntime::StepSTATIC_Impl( OUString& aName, SbxDataType& t )
                 p->SetFlag( SbxFlagBits::Fixed );
             }
             p->SetName( aName );
+            implHandleSbxFlags( p, t, nOp2 );
             pStatics->Put( p, pStatics->Count() );
         }
     }
@@ -4625,8 +4627,8 @@ SbxVariable* SbiRuntime::StepSTATIC_Impl( OUString& aName, SbxDataType& t )
 void SbiRuntime::StepSTATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
 {
     OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
-    SbxDataType t = (SbxDataType) nOp2;
-    StepSTATIC_Impl( aName, t );
+    SbxDataType t = (SbxDataType) (nOp2 & 0xffff);
+    StepSTATIC_Impl( aName, t, nOp2 );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list