From cba3b6a12c9f0dc67a93bc3b708497a8f5eea5a5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sun, 15 Dec 2019 10:03:56 +0100 Subject: [PATCH 4/8] Fix use of uninitialized SwFEShell::bTableCopied ...which had been introduced with 1e278d1d0cfb1d5375195aa764739f00633f21e8 "tdf#37156 Writer menu: Paste as Nested table", during `make CppunitTest_sw_uiwriter CPPUNIT_TEST_NAME=SwUiWriterTest::testDde VALGRIND=memcheck`: > Conditional jump or move depends on uninitialised value(s) > at 0x1EBBFAF8: SwTransferable::PrepareForCopy(bool) (sw/source/uibase/dochdl/swdtflvr.cxx:896) > by 0x1EBC22BA: SwTransferable::Copy(bool) (sw/source/uibase/dochdl/swdtflvr.cxx:1144) > by 0x1ECB552D: SwBaseShell::ExecClpbrd(SfxRequest&) (sw/source/uibase/shells/basesh.cxx:277) > by 0x1C0D0BB0: SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (include/sfx2/shell.hxx:197) > by 0x1C0D72EB: SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) (sfx2/source/control/dispatch.cxx:764) > by 0x1C153977: SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) (sfx2/source/control/unoctitm.cxx:760) > by 0x1C154916: SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) (sfx2/source/control/unoctitm.cxx:245) > by 0x21FDE395: framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference const&, com::sun::star::util::URL const&, bool, com::sun::star::uno::Sequence const&) (framework/source/services/dispatchhelper.cxx:151) > by 0x21FDEC95: framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) (framework/source/services/dispatchhelper.cxx:109) > by 0x19BF89C7: lcl_dispatchCommand(com::sun::star::uno::Reference const&, rtl::OUString const&, com::sun::star::uno::Sequence const&) (sw/qa/extras/uiwriter/uiwriter.cxx:4048) > by 0x19C1F3EC: SwUiWriterTest::testDde() (sw/qa/extras/uiwriter/uiwriter.cxx:4060) > Uninitialised value was created by a heap allocation > at 0x4839E86: operator new(unsigned long) (/builddir/build/BUILD/valgrind-3.15.0/coregrind/m_replacemalloc/vg_replace_malloc.c:344) > by 0x1ED6DA43: SwView::SwView(SfxViewFrame*, SfxViewShell*) (sw/source/uibase/uiview/view.cxx:864) > by 0x1ED70065: SwView::CreateInstance(SfxViewFrame*, SfxViewShell*) (sw/source/uibase/uiview/view0.cxx:79) > by 0x1C347941: SfxBaseModel::createViewController(rtl::OUString const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) (sfx2/source/doc/sfxbasemodel.cxx:4233) > by 0x1C458D81: (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) (sfx2/source/view/frmload.cxx:587) > by 0x2401FAD0: framework::LoadEnv::impl_loadContent() (framework/source/loadenv/loadenv.cxx:1159) > by 0x24020735: framework::LoadEnv::start() (framework/source/loadenv/loadenv.cxx:392) > by 0x24020F89: framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&, rtl::OUString const&, int, LoadEnvFeatures) (framework/source/loadenv/loadenv.cxx:297) > by 0x2402175B: 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&) (framework/source/loadenv/loadenv.cxx:166) > by 0x24058172: framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) (framework/source/services/desktop.cxx:610) > by 0x1F5F7306: unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence const&) (unotest/source/cpp/macros_test.cxx:48) > by 0x19C646A7: SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) (sw/qa/inc/swmodeltestbase.hxx:764) > by 0x19BD3792: SwUiWriterTest::createDoc(char const*) (sw/qa/extras/uiwriter/uiwriter.cxx:576) > by 0x19C1F352: SwUiWriterTest::testDde() (sw/qa/extras/uiwriter/uiwriter.cxx:4055) (produced with a --enable-optimized build, so some inline frames are elided; see also for the same issue detected with UBSan). Change-Id: I080d296006bad4726942fb95a1338ea46c12bed4 Reviewed-on: https://gerrit.libreoffice.org/85162 Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit bcc74f619bf87ab97ffc48ab33e031d357952a70) --- sw/source/core/frmedt/fews.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 2ad7ec20a86f..0c4e097287c2 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -665,6 +665,7 @@ SwFEShell::SwFEShell( SwDoc& rDoc, vcl::Window *pWindow, const SwViewOption *pOp , m_bCheckForOLEInCaption(false) , m_aPasteListeners(GetPasteMutex()) , m_eTableInsertMode(SwTable::SEARCH_NONE) + , bTableCopied(false) { } @@ -673,6 +674,7 @@ SwFEShell::SwFEShell( SwEditShell& rShell, vcl::Window *pWindow ) , m_bCheckForOLEInCaption(false) , m_aPasteListeners(GetPasteMutex()) , m_eTableInsertMode(SwTable::SEARCH_NONE) + , bTableCopied(false) { } -- 2.28.0