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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 21 15:34:55 UTC 2019


 sw/source/filter/ww8/ww8scan.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit b54889fb57ecdc2d8fe1badcb325c1ed70e9e7ec
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Oct 21 15:42:56 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Oct 21 17:33:38 2019 +0200

    -fsanitize=nullptr-with-nonzero-offset
    
    ...(new with Clang 10 trunk), as seen during CppunitTest_svx_unit:
    
    > sw/source/filter/ww8/ww8scan.cxx:2758:69: runtime error: applying non-zero offset 2 to null pointer
    >  #0 in WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(WW8Fib const&, SvStream*, SvStream*, long, long, ePLCFT, int) at sw/source/filter/ww8/ww8scan.cxx:2758:69
    >  #1 in WW8PLCFx_Fc_FKP::NewFkp() at sw/source/filter/ww8/ww8scan.cxx:3088:24
    >  #2 in WW8PLCFx_Fc_FKP::GetSprmsAndPos(int&, int&, int&) at sw/source/filter/ww8/ww8scan.cxx:3202:14
    >  #3 in WW8PLCFx_Cp_FKP::GetSprms(WW8PLCFxDesc*) at sw/source/filter/ww8/ww8scan.cxx:3385:39
    >  #4 in WW8PLCFMan::GetNewSprms(WW8PLCFxDesc&) at sw/source/filter/ww8/ww8scan.cxx:4852:19
    >  #5 in WW8PLCFMan::WW8PLCFMan(WW8ScannerBase const*, ManTypes, long, bool) at sw/source/filter/ww8/ww8scan.cxx:5059:21
    >  #6 in SwWW8ImplReader::ReadText(int, int, ManTypes) at sw/source/filter/ww8/ww8par.cxx:4018:26
    >  #7 in SwWW8ImplReader::CoreLoad(WW8Glossary const*) at sw/source/filter/ww8/ww8par.cxx:5236:9
    >  #8 in SwWW8ImplReader::LoadThroughDecryption(WW8Glossary*) at sw/source/filter/ww8/ww8par.cxx:5900:19
    >  #9 in SwWW8ImplReader::LoadDoc(WW8Glossary*) at sw/source/filter/ww8/ww8par.cxx:6204:19
    >  #10 in WW8Reader::Read(SwDoc&, rtl::OUString const&, SwPaM&, rtl::OUString const&) at sw/source/filter/ww8/ww8par.cxx:6355:26
    >  #11 in SwReader::Read(Reader const&) at sw/source/filter/basflt/shellio.cxx:188:22
    >  #12 in SwDocShell::ConvertFrom(SfxMedium&) at sw/source/uibase/app/docsh.cxx:261:26
    >  #13 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:768:23
    >  #14 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1851:36
    >  #15 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&) at sfx2/source/view/frmload.cxx:691:28
    >  #16 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1157:37
    >  #17 in framework::LoadEnv::startLoading() at framework/source/loadenv/loadenv.cxx:390:20
    >  #18 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&) at framework/source/loadenv/loadenv.cxx:171:14
    >  #19 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:621:12
    >  #21 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:48:62
    >  #22 in (anonymous namespace)::testHalfEllipseVML::TestBody() at svx/qa/unit/customshapes.cxx:212:19
    
    I have no idea whether aEntry.mpData can legitimately be null here, whether this
    is due to some previous processing error, or...
    
    Change-Id: I7dd2f568c57d8ce66774066534ef9ec86fe254e3
    Reviewed-on: https://gerrit.libreoffice.org/81239
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 38e3db7377be..841f564e2ace 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2755,9 +2755,10 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(const WW8Fib& rFib, SvStream* pSt,
                          of the new data
                         */
                         const bool bExpand = IsExpandableSprm(nSpId);
-                        const sal_uInt8* pStartData = aEntry.mpData + 2;
+                        const sal_uInt8* pStartData
+                            = aEntry.mpData == nullptr ? nullptr : aEntry.mpData + 2;
                         const sal_uInt8* pLastValidDataPos = maRawData + 512 - sizeof(sal_uInt32);
-                        if (pStartData > pLastValidDataPos)
+                        if (pStartData != nullptr && pStartData > pLastValidDataPos)
                             pStartData = nullptr;
                         if ((IsReplaceAllSprm(nSpId) || bExpand) && pStartData)
                         {


More information about the Libreoffice-commits mailing list