office-gobmx/external/boost/ubsan.patch.0
Stephan Bergmann 262daf10fa external/boost: Avoid -fsanitize=pointer-overflow
...as seen during e.g. CppunitTest_sw_ooxmlexport8, when

  (n < (m_end - p) ? n : n - capacity())

is promoted to unsigned type size_t:

> workdir/UnpackedTarball/boost/boost/circular_buffer/base.hpp:2358:18: runtime error: unsigned pointer index expression result is 0x602000b97110, preceding its base 0x602000b97118
>     #0 0x7f77c69a7721 in SwFrameFormat** boost::circular_buffer<SwFrameFormat*, std::allocator<SwFrameFormat*> >::add<SwFrameFormat**>(SwFrameFormat**, long) const workdir/UnpackedTarball/boost/boost/circular_buffer/base.hpp:2358:18
>     #1 0x7f77c69a7635 in boost::circular_buffer<SwFrameFormat*, std::allocator<SwFrameFormat*> >::destroy_content(boost::integral_constant<bool, true> const&) workdir/UnpackedTarball/boost/boost/circular_buffer/base.hpp:2460:19
>     #2 0x7f77c69a7493 in boost::circular_buffer<SwFrameFormat*, std::allocator<SwFrameFormat*> >::destroy_content() workdir/UnpackedTarball/boost/boost/circular_buffer/base.hpp:2454:9
>     #3 0x7f77c69a7369 in boost::circular_buffer<SwFrameFormat*, std::allocator<SwFrameFormat*> >::destroy() workdir/UnpackedTarball/boost/boost/circular_buffer/base.hpp:2471:9
>     #4 0x7f77c699d386 in boost::circular_buffer<SwFrameFormat*, std::allocator<SwFrameFormat*> >::~circular_buffer() workdir/UnpackedTarball/boost/boost/circular_buffer/base.hpp:1193:9
>     #5 0x7f77c6971187 in AppendAllObjs(SwFrameFormats const*, SwFrame const*) sw/source/core/layout/frmtool.cxx:1125:1
>     #6 0x7f77c6976f7b in InsertCnt_(SwLayoutFrame*, SwDoc*, unsigned long, bool, unsigned long, SwFrame*) sw/source/core/layout/frmtool.cxx:1514:13
>     #7 0x7f77c6a65698 in SwRootFrame::Init(SwFrameFormat*) sw/source/core/layout/newfrm.cxx:552:5
>     #8 0x7f77c7ba0d86 in SwViewShell::Init(SwViewOption const*) sw/source/core/view/vnew.cxx:126:23
>     #9 0x7f77c7ba29ff in SwViewShell::SwViewShell(SwDoc&, vcl::Window*, SwViewOption const*, OutputDevice*, long) sw/source/core/view/vnew.cxx:183:5
>     #10 0x7f77c57a75fe in SwCursorShell::SwCursorShell(SwDoc&, vcl::Window*, SwViewOption const*) sw/source/core/crsr/crsrsh.cxx:2672:7
>     #11 0x7f77c657a0af in SwEditShell::SwEditShell(SwDoc&, vcl::Window*, SwViewOption const*) sw/source/core/edit/edws.cxx:43:7
>     #12 0x7f77c67602f1 in SwFEShell::SwFEShell(SwDoc&, vcl::Window*, SwViewOption const*) sw/source/core/frmedt/fews.cxx:687:7
>     #13 0x7f77c8e9758b in SwWrtShell::SwWrtShell(SwDoc&, vcl::Window*, SwView&, SwViewOption const*) sw/source/uibase/wrtsh/wrtsh1.cxx:1643:7
>     #14 0x7f77c8a797f0 in SwView::SwView(SfxViewFrame*, SfxViewShell*) sw/source/uibase/uiview/view.cxx:811:27
>     #15 0x7f77c8aa4ab6 in SwView::CreateInstance(SfxViewFrame*, SfxViewShell*) sw/source/uibase/uiview/view0.cxx:78:1
>     #16 0x7f77d0e688c4 in SfxBaseModel::createViewController(rtl::OUString const&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&, com::sun::uno::Reference<com::sun::frame::XFrame> const&) sfx2/source/doc/sfxbasemodel.cxx:4094:46
>     #17 0x7f77d0e6a08f in non-virtual thunk to SfxBaseModel::createViewController(rtl::OUString const&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&, com::sun::uno::Reference<com::sun::frame::XFrame> const&) sfx2/source/doc/sfxbasemodel.cxx
>     #18 0x7f77d11ab1e3 in (anonymous namespace)::SfxFrameLoader_Impl::impl_createDocumentView(com::sun::uno::Reference<com::sun::frame::XModel2> const&, com::sun::uno::Reference<com::sun::frame::XFrame> const&, comphelper::NamedValueCollection const&, rtl::OUString const&) sfx2/source/view/frmload.cxx:590:60
>     #19 0x7f77d11a71ca in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&, com::sun::uno::Reference<com::sun::frame::XFrame> const&) sfx2/source/view/frmload.cxx:717:13
>     #20 0x7f779960c3d1 in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1083:37
>     #21 0x7f77996054f4 in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:372:20
>     #22 0x7f7799603759 in framework::LoadEnv::loadComponentFromURL(com::sun::uno::Reference<com::sun::frame::XComponentLoader> const&, com::sun::uno::Reference<com::sun::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) framework/source/loadenv/loadenv.cxx:158:14
>     #23 0x7f77996ba887 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) framework/source/services/desktop.cxx:624:12
>     #24 0x7f77996baa8c in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) framework/source/services/desktop.cxx
>     #25 0x7f77d2f9abed in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) unotest/source/cpp/macros_test.cxx:50:60
>     #26 0x7f77d3b286d6 in SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:648:23
>     #27 0x7f77d3b27de2 in SwModelTestBase::load(char const*, char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:619:16
>     #28 0x7f77d3b277b7 in SwModelTestBase::executeImportTest(char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:224:13
>     #29 0x7f77d3cec8e6 in void std::_Bind<std::_Mem_fn<void (testFdo78939::*)()> (testFdo78939*)>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:933:11
>     #30 0x7f77d3cec6ed in void std::_Bind<std::_Mem_fn<void (testFdo78939::*)()> (testFdo78939*)>::operator()<, void>() /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:991:17
>     #31 0x7f7808612258 in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
>     #32 0x7f78085e30d5 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
>     #33 0x7f78085e30d5 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
>     #34 0x7f77fc7fe014 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16
>     #35 0x7f78085e30d5 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
>     #36 0x7f780857932d in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
>     #37 0x7f78085e30d5 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
>     #38 0x7f78085dc5fa in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18
>     #39 0x7f7808674598 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
>     #40 0x7f7808610859 in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
>     #41 0x7f7808614624 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
>     #42 0x7f780861387c in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
>     #43 0x7f7808614624 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
>     #44 0x7f780861387c in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
>     #45 0x7f78086a2f5c in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
>     #46 0x7f780867304e in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:9
>     #47 0x7f78086a3e7e 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
>     #48 0x532f3d in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:316:20
>     #49 0x53101c in sal_main() sal/cppunittester/cppunittester.cxx:466:20
>     #50 0x530a36 in main sal/cppunittester/cppunittester.cxx:373:1
>     #51 0x7f7806bc4400 in __libc_start_main /usr/src/debug/glibc-2.24-59-g86ac4a7/csu/../csu/libc-start.c:289
>     #52 0x4385a9 in _start (workdir/LinkTarget/Executable/cppunittester+0x4385a9)

Change-Id: I4f32ce04daa61cc05dd6b8ef7c84c238c927056c
2017-07-05 14:27:53 +02:00

35 lines
1.2 KiB
Text

Work around -fsanitize=bool and -fsanitize=nonnull-attribute
--- boost/algorithm/string/find_iterator.hpp
+++ boost/algorithm/string/find_iterator.hpp
@@ -240,7 +240,7 @@
m_Match(Other.m_Match),
m_Next(Other.m_Next),
m_End(Other.m_End),
- m_bEof(Other.m_bEof)
+ m_bEof(Other.eof())
{}
//! Constructor
--- boost/circular_buffer/base.hpp
+++ boost/circular_buffer/base.hpp
@@ -2355,7 +2355,7 @@
//! Add <code>n</code> to the pointer.
template <class Pointer>
Pointer add(Pointer p, difference_type n) const {
- return p + (n < (m_end - p) ? n : n - capacity());
+ return p + (n < (m_end - p) ? n : difference_type(n - capacity()));
}
//! Subtract <code>n</code> from the pointer.
--- boost/circular_buffer/debug.hpp
+++ boost/circular_buffer/debug.hpp
@@ -34,7 +34,7 @@
template <class T>
inline void do_fill_uninitialized_memory(T* data, std::size_t size_in_bytes) BOOST_NOEXCEPT {
- std::memset(static_cast<void*>(data), UNINITIALIZED, size_in_bytes);
+ if (size_in_bytes != 0) std::memset(static_cast<void*>(data), UNINITIALIZED, size_in_bytes);
}
template <class T>