office-gobmx/external/graphite/ubsan.patch
Stephan Bergmann a7603be5cc Add back still-relevant part of external/graphite/ubsan.patch
...which had been removed completely with
6b84708914 "graphite: update to 1.3.12".  See
<https://ci.libreoffice.org/job/lo_ubsan/1137/>:

> /workdir/UnpackedTarball/graphite/src/gr_face.cpp:98:16: runtime error: downcast of address 0x60f00008c3b0 which does not point to an object of type 'gr_face'
> 0x60f00008c3b0: note: object is of type 'graphite2::Face'
>  2a 00 00 61  d0 17 e7 ff 99 2b 00 00  36 00 be be be be be be  88 d8 0e 00 d0 61 00 00  80 38 05 00
>               ^~~~~~~~~~~~~~~~~~~~~~~
>               vptr for 'graphite2::Face'
>     #0 0x2b99fdaae105 in gr_make_face_with_ops /workdir/UnpackedTarball/graphite/src/gr_face.cpp:98:16
>     #1 0x2b99fdaaeabe in gr_make_face /workdir/UnpackedTarball/graphite/src/gr_face.cpp:107:12
>     #2 0x2b99fdfd6dc7 in _hb_graphite2_shaper_face_data_create /workdir/UnpackedTarball/harfbuzz/src/hb-graphite2.cc:114:18
>     #3 0x2b99fdfd62f0 in hb_graphite2_shaper_face_data_ensure /workdir/UnpackedTarball/harfbuzz/src/hb-graphite2.cc:37:1
>     #4 0x2b99fddb6a10 in hb_shape_plan_create_cached2 /workdir/UnpackedTarball/harfbuzz/src/./hb-shaper-list.hh:35:1
>     #5 0x2b99fddb1478 in hb_shape_full /workdir/UnpackedTarball/harfbuzz/src/hb-shape.cc:133:33
>     #6 0x2b99fc5867df in GenericSalLayout::LayoutText(ImplLayoutArgs&, SalLayoutGlyphs const*) /vcl/source/gdi/CommonSalLayout.cxx:440:23
>     #7 0x2b99fb2345e4 in OutputDevice::ImplLayout(rtl::OUString const&, int, int, Point const&, long, long const*, SalLayoutFlags, vcl::TextLayoutCache const*, SalLayoutGlyphs const*) const /vcl/source/outdev/text.cxx:1310:36
>     #8 0x2b99fb236220 in OutputDevice::GetTextArray(rtl::OUString const&, long*, int, int, vcl::TextLayoutCache const*, SalLayoutGlyphs const*) const /vcl/source/outdev/text.cxx:960:45
>     #9 0x2b99fb235c56 in OutputDevice::GetTextWidth(rtl::OUString const&, int, int, vcl::TextLayoutCache const*, SalLayoutGlyphs const*) const /vcl/source/outdev/text.cxx:881:19
>     #10 0x2b99fd105281 in ImplFontMetricData::ImplInitTextLineSize(OutputDevice const*) /vcl/source/font/fontmetric.cxx:325:30
>     #11 0x2b99fb1c128c in OutputDevice::ImplNewFont() const /vcl/source/outdev/font.cxx:1062:38
>     #12 0x2b99fb1bd46c in OutputDevice::GetFontFeatures(std::__debug::vector<vcl::font::Feature, std::allocator<vcl::font::Feature> >&) const /vcl/source/outdev/font.cxx:171:10
>     #13 0x2b9a1a3c8607 in FontFeatureTest::testGetFontFeatures() /vcl/qa/cppunit/FontFeatureTest.cxx:58:5
>     #14 0x2b9a1a401f2c in void std::__invoke_impl<void, void (FontFeatureTest::*&)(), FontFeatureTest*&>(std::__invoke_memfun_deref, void (FontFeatureTest::*&)(), FontFeatureTest*&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/invoke.h:73:14
>     #15 0x2b9a1a401b0f in std::__invoke_result<void (FontFeatureTest::*&)(), FontFeatureTest*&>::type std::__invoke<void (FontFeatureTest::*&)(), FontFeatureTest*&>(void (FontFeatureTest::*&)(), FontFeatureTest*&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/invoke.h:95:14
>     #16 0x2b9a1a40195c in void std::_Bind<void (FontFeatureTest::* (FontFeatureTest*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/functional:467:11
>     #17 0x2b9a1a401533 in void std::_Bind<void (FontFeatureTest::* (FontFeatureTest*))()>::operator()<void>() /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/functional:549:17
>     #18 0x2b9a1a400340 in std::_Function_handler<void (), std::_Bind<void (FontFeatureTest::* (FontFeatureTest*))()> >::_M_invoke(std::_Any_data const&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/std_function.h:316:2
>     #19 0x2b9a1a40259c in std::function<void ()>::operator()() const /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/std_function.h:706:14
>     #20 0x2b9a1a3ff580 in CppUnit::TestCaller<FontFeatureTest>::runTest() /workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7
>     #21 0x2b99d930dab8 in CppUnit::TestCaseMethodFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
>     #22 0x2b99f39cf332 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /test/source/vclbootstrapprotector.cxx:49:14
>     #23 0x2b99d92de5fa in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
>     #24 0x2b99e850d672 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
>     #25 0x2b99d92de5fa in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
>     #26 0x2b99e5130312 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16
>     #27 0x2b99d92de5fa in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
>     #28 0x2b99d9273d82 in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
>     #29 0x2b99d92de5fa in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
>     #30 0x2b99d92d7f02 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18
>     #31 0x2b99d93705e5 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
>     #32 0x2b99d930c135 in CppUnit::TestCase::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
>     #33 0x2b99d930ff12 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
>     #34 0x2b99d930f0ed in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
>     #35 0x2b99d930ff12 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
>     #36 0x2b99d930f0ed in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
>     #37 0x2b99d939eb32 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
>     #38 0x2b99d936f075 in CppUnit::TestResult::runTest(CppUnit::Test*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:9
>     #39 0x2b99d939fa80 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
>     #40 0x543813 in (anonymous namespace)::ProtectedFixtureFunctor::run() const /sal/cppunittester/cppunittester.cxx:316:20
>     #41 0x54027d in sal_main() /sal/cppunittester/cppunittester.cxx:466:20
>     #42 0x53f26e in main /sal/cppunittester/cppunittester.cxx:373:1
>     #43 0x2b99daec8444 in __libc_start_main (/lib64/libc.so.6+0x22444)
>     #44 0x42f454 in _start (/workdir/LinkTarget/Executable/cppunittester+0x42f454)
>
> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /workdir/UnpackedTarball/graphite/src/gr_face.cpp:98:16 in
>
> Error: a unit test failed, please do one of:
>
> make CppunitTest_vcl_fontfeature CPPUNITTRACE="gdb --args"
>     # for interactive debugging on Linux
> make CppunitTest_vcl_fontfeature VALGRIND=memcheck
>     # for memory checking
> make CppunitTest_vcl_fontfeature DEBUGCPPUNIT=TRUE
>     # for exception catching
>
> You can limit the execution to just one particular test by:
>
> make CPPUNIT_TEST_NAME="testXYZ" ...above mentioned params...
>
> /home/tdf/lode/jenkins/workspace/lo_ubsan/solenv/gbuild/CppunitTest.mk:113: recipe for target '/home/tdf/lode/jenkins/workspace/lo_ubsan/workdir/CppunitTest/vcl_fontfeature.test' failed

Change-Id: Iccb72ec8a4c507478858ceb5af32b75f5ae53a45
Reviewed-on: https://gerrit.libreoffice.org/65226
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-12-16 21:45:31 +01:00

11 lines
283 B
Diff

--- src/gr_face.cpp
+++ src/gr_face.cpp
@@ -95,7 +95,7 @@
Face *res = new Face(appFaceHandle, *ops);
if (res && load_face(*res, faceOptions))
- return static_cast<gr_face *>(res);
+ return reinterpret_cast<gr_face *>(res);
delete res;
return 0;