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

Stephan Bergmann sbergman at redhat.com
Fri Oct 6 11:49:54 UTC 2017


 sw/source/core/layout/newfrm.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 63d845dc88690b9c5c8194e1512a8e4390c7ee24
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 6 11:46:25 2017 +0200

    Fix -fsanitize=signed-integer-overflow
    
    during CppunitTest_sw_uiwriter (see below), using o3tl::saturating_add similar
    to 97dcb242f5cc41216fd16503604ca2f29f147a2a "Fix -fsanitize=signed-integer-
    overflow".
    
    It replaces exactly the one use of SwIncrement that caused problems now.
    Probably other uses of those FirstMinusSecond, SecondMinusFirst, SwIncrement,
    and SwDecrement should be adapted, too.
    
    > sw/source/core/layout/newfrm.cxx:53:17: runtime error: signed integer overflow: 23547 + 9223372036854755850 cannot be represented in type 'long'
    >     #0 0x7f00fe99e438 in SwIncrement(long, long) sw/source/core/layout/newfrm.cxx:53:17
    >     #1 0x7f00feb272bc in SwTabFrame::MakeAll(OutputDevice*) sw/source/core/layout/tabfrm.cxx:2311:44
    >     #2 0x7f00fe79d883 in SwFrame::PrepareMake(OutputDevice*) sw/source/core/layout/calcmove.cxx:312:29
    >     #3 0x7f00feb1cbff in SwContentFrame::CalcLowers(SwLayoutFrame*, SwLayoutFrame const*, long, bool) sw/source/core/layout/tabfrm.cxx:1454:19
    >     #4 0x7f00feb2eded in lcl_RecalcRow(SwRowFrame&, long) sw/source/core/layout/tabfrm.cxx:1581:22
    >     #5 0x7f00feb186d5 in lcl_RecalcSplitLine(SwRowFrame&, SwRowFrame&, long, long) sw/source/core/layout/tabfrm.cxx:682:5
    >     #6 0x7f00feb13900 in SwTabFrame::Split(long, bool, bool) sw/source/core/layout/tabfrm.cxx:1268:16
    >     #7 0x7f00feb20ed9 in SwTabFrame::MakeAll(OutputDevice*) sw/source/core/layout/tabfrm.cxx:2387:47
    >     #8 0x7f00fe79df2b in SwFrame::PrepareMake(OutputDevice*) sw/source/core/layout/calcmove.cxx:346:5
    >     #9 0x7f00fe945f70 in SwLayAction::FormatLayoutTab(SwTabFrame*, bool) sw/source/core/layout/layact.cxx:1467:15
    >     #10 0x7f00fe93e6ca in SwLayAction::FormatLayout(OutputDevice*, SwLayoutFrame*, bool) sw/source/core/layout/layact.cxx:1360:32
    >     #11 0x7f00fe93e95b in SwLayAction::FormatLayout(OutputDevice*, SwLayoutFrame*, bool) sw/source/core/layout/layact.cxx:1363:29
    >     #12 0x7f00fe9329c9 in SwLayAction::InternalAction(OutputDevice*) sw/source/core/layout/layact.cxx:550:25
    >     #13 0x7f00fe92f71a in SwLayAction::Action(OutputDevice*) sw/source/core/layout/layact.cxx:341:5
    >     #14 0x7f00ffa7bcfd in SwViewShell::ImplEndAction(bool) sw/source/core/view/viewsh.cxx:280:17
    >     #15 0x7f00fd6e5671 in SwViewShell::EndAction(bool) sw/inc/viewsh.hxx:605:9
    >     #16 0x7f00fd696865 in SwCursorShell::EndAction(bool, bool) sw/source/core/crsr/crsrsh.cxx:258:18
    >     #17 0x7f0100a66752 in SwView::OuterResizePixel(Point const&, Size const&) sw/source/uibase/uiview/viewport.cxx:1116:22
    >     #18 0x7f01177ff562 in SfxViewFrame::DoAdjustPosSizePixel(SfxViewShell*, Point const&, Size const&, bool) sfx2/source/view/viewfrm.cxx:1490:18
    >     #19 0x7f0117812660 in SfxViewFrame::Resize(bool) sfx2/source/view/viewfrm.cxx:2275:17
    >     #20 0x7f01178262e9 in SfxFrameViewWindow_Impl::Resize() sfx2/source/view/viewfrm2.cxx:73:17
    >     #21 0x7f01397ce063 in vcl::Window::ImplCallResize() vcl/source/window/event.cxx:522:5
    >     #22 0x7f0139c1458e in vcl::Window::Show(bool, ShowFlags) vcl/source/window/window.cxx:2274:13
    >     #23 0x7f01177b8313 in SfxBaseController::ConnectSfxFrame_Impl(SfxBaseController::ConnectSfxFrame) sfx2/source/view/sfxbasecontroller.cxx:1250:24
    >     #24 0x7f01177b6773 in SfxBaseController::attachFrame(com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) sfx2/source/view/sfxbasecontroller.cxx:550:13
    >     #25 0x7f01177708ca in (anonymous namespace)::SfxFrameLoader_Impl::impl_createDocumentView(com::sun::star::uno::Reference<com::sun::star::frame::XModel2> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, comphelper::NamedValueCollection const&, rtl::OUString const&) sfx2/source/view/frmload.cxx:599:18
    >     #26 0x7f011776c4dc 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&) sfx2/source/view/frmload.cxx:716:13
    >     #27 0x7f00cd09827c in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1087:37
    >     #28 0x7f00cd0914f3 in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:372:20
    >     #29 0x7f00cd08f794 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&) framework/source/loadenv/loadenv.cxx:158:14
    >     #30 0x7f00cd146748 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:618:12
    >     #31 0x7f00cd14690c in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx
    >     #32 0x7f00f5b07b89 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) unotest/source/cpp/macros_test.cxx:50:60
    >     #33 0x7f011ff48982 in SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:668:23
    >     #34 0x7f011ff49579 in SwModelTestBase::load(rtl::OUString const&, char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:639:16
    >     #35 0x7f011fe18545 in SwUiWriterTest::createDoc(char const*) sw/qa/extras/uiwriter/uiwriter.cxx:448:9
    >     #36 0x7f011fffcbb2 in void std::_Bind<std::_Mem_fn<void (SwUiWriterTest::*)()> (SwUiWriterTest*)>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:933:11
    >     #37 0x7f011fffc989 in void std::_Bind<std::_Mem_fn<void (SwUiWriterTest::*)()> (SwUiWriterTest*)>::operator()<, void>() /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:991:17
    >     #38 0x7f0159d6bd20 in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
    >     #39 0x7f0159d3ceed in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
    >     #40 0x7f0159d3ceed in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
    >     #41 0x7f014e24e450 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16
    >     #42 0x7f0159d3ceed in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
    >     #43 0x7f0159cd271b in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
    >     #44 0x7f0159d3ceed in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
    >     #45 0x7f0159d3652c in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18
    >     #46 0x7f0159dce8f0 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:182:28
    >     #47 0x7f0159d6a2fc in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
    >     #48 0x7f0159d6e1f7 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
    >     #49 0x7f0159d6d3e8 in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
    >     #50 0x7f0159d6e1f7 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
    >     #51 0x7f0159d6d3e8 in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
    >     #52 0x7f0159dfcf15 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
    >     #53 0x7f0159dcd376 in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:9
    >     #54 0x7f0159dfde86 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14
    >     #55 0x535621 in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:319:20
    >     #56 0x5336e4 in sal_main() sal/cppunittester/cppunittester.cxx:469:20
    >     #57 0x533112 in main sal/cppunittester/cppunittester.cxx:376:1
    >     #58 0x7f0158225430 in __libc_start_main /usr/src/debug/glibc-2.24-66-gd5a4092c36/csu/../csu/libc-start.c:289
    >     #59 0x438929 in _start (workdir/LinkTarget/Executable/cppunittester+0x438929)
    
    Change-Id: Ib3dd6317062b39625295ae0b51c30d3826918b35
    Reviewed-on: https://gerrit.libreoffice.org/43191
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 6673ed22b909..c51c379b89cf 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <o3tl/safeint.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/svdpage.hxx>
 #include <drawdoc.hxx>
@@ -104,7 +107,7 @@ static SwRectFnCollection aHorizontal = {
     &FirstMinusSecond,
     &FirstMinusSecond,
     &SwIncrement,
-    &SwIncrement,
+    &o3tl::saturating_add<long>,
     &SwRect::SetLeftAndWidth,
     &SwRect::SetTopAndHeight
 };


More information about the Libreoffice-commits mailing list