Kaydet (Commit) 6694ce6b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

external/harfbuzz: Work around ASan out of bounds warning

CppunitTest_sccomp_lpsolver failed with the below error.  struct _mtx
(hb-ot-hmtx-table.hh) has two "variable-sized" array members (each of size
VAR=1) longMetric and leadingBearingX, where the latter isn't used anywhere in
the code; so removing it would make ASan's variable-sized array member heuristic
kick in here and suppress the warning, but who knows whether there's some
requirement on the exact sizeof(_mtx).

> hb-ot-font.cc:128:12: runtime error: index 3 out of bounds for type 'OT::LongMetric const[1]'
>  hb_ot_face_metrics_accelerator_t::get_advance(unsigned int) const workdir/UnpackedTarball/harfbuzz/src/hb-ot-font.cc:128:43
>  hb_ot_get_glyph_h_advance(hb_font_t*, void*, unsigned int, void*) workdir/UnpackedTarball/harfbuzz/src/hb-ot-font.cc:439:47
>  hb_font_t::get_glyph_h_advance(unsigned int) workdir/UnpackedTarball/harfbuzz/src/./hb-font-private.hh:207:12
>  hb_ot_position_default(hb_ot_shape_context_t*) workdir/UnpackedTarball/harfbuzz/src/hb-ot-shape.cc:613:35
>  hb_ot_position(hb_ot_shape_context_t*) workdir/UnpackedTarball/harfbuzz/src/hb-ot-shape.cc:719:3
>  hb_ot_shape_internal(hb_ot_shape_context_t*) workdir/UnpackedTarball/harfbuzz/src/hb-ot-shape.cc:768:3
>  _hb_ot_shape workdir/UnpackedTarball/harfbuzz/src/hb-ot-shape.cc:792:3
>  hb_shape_plan_execute workdir/UnpackedTarball/harfbuzz/src/./hb-shaper-list.hh:43:1
>  CommonSalLayout::LayoutText(ImplLayoutArgs&) vcl/source/gdi/CommonSalLayout.cxx:485:23
>  OutputDevice::ImplLayout(rtl::OUString const&, int, int, Point const&, long, long const*, SalLayoutFlags, vcl::TextLayoutCache const*) const vcl/source/outdev/text.cxx:1400:36
>  OutputDevice::GetTextArray(rtl::OUString const&, long*, int, int, vcl::TextLayoutCache const*) const vcl/source/outdev/text.cxx:999:35
>  OutputDevice::GetTextWidth(rtl::OUString const&, int, int, vcl::TextLayoutCache const*) const vcl/source/outdev/text.cxx:915:19
>  ImplFontMetricData::ImplInitTextLineSize(OutputDevice const*) vcl/source/font/fontmetric.cxx:372:30
>  OutputDevice::ImplNewFont() const vcl/source/outdev/font.cxx:1100:42
>  OutputDevice::GetTextHeight() const vcl/source/outdev/text.cxx:924:14
>  vcl::Window::ImplInitAppFontData(vcl::Window*) vcl/source/window/window.cxx:1177:33
>  vcl::Window::ImplInit(vcl::Window*, long, SystemParentData*) vcl/source/window/window.cxx:1168:9
>  ImplBorderWindow::ImplInit(vcl::Window*, long, BorderWindowStyle, SystemParentData*) vcl/source/window/brdwin.cxx:1758:13
>  ImplBorderWindow::ImplBorderWindow(vcl::Window*, SystemParentData*, long, BorderWindowStyle) vcl/source/window/brdwin.cxx:1790:5
>  VclPtrInstance<ImplBorderWindow>::VclPtrInstance<vcl::Window*&, SystemParentData*&, long&, BorderWindowStyle&>(vcl::Window*&, SystemParentData*&, long&, BorderWindowStyle&) include/vcl/vclptr.hxx:281:39
>  WorkWindow::ImplInit(vcl::Window*, long, SystemParentData*) vcl/source/window/wrkwin.cxx:52:38
>  WorkWindow::WorkWindow(vcl::Window*, long) vcl/source/window/wrkwin.cxx:95:5
>  VclPtr<WorkWindow> VclPtr<WorkWindow>::Create<vcl::Window*&, long&>(vcl::Window*&, long&) include/vcl/vclptr.hxx:131:46
>  (anonymous namespace)::VCLXToolkit::ImplCreateWindow(VCLXWindow**, com::sun::star::awt::WindowDescriptor const&, vcl::Window*, long) toolkit/source/awt/vclxtoolkit.cxx:1195:42
>  (anonymous namespace)::VCLXToolkit::ImplCreateWindow(com::sun::star::awt::WindowDescriptor const&, long) toolkit/source/awt/vclxtoolkit.cxx:1306:22
>  (anonymous namespace)::VCLXToolkit::createWindow(com::sun::star::awt::WindowDescriptor const&) toolkit/source/awt/vclxtoolkit.cxx:799:12
>  non-virtual thunk to (anonymous namespace)::VCLXToolkit::createWindow(com::sun::star::awt::WindowDescriptor const&) toolkit/source/awt/vclxtoolkit.cxx:797:59
>  (anonymous namespace)::TaskCreatorService::implts_createContainerWindow(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::awt::Rectangle const&, bool) framework/source/services/taskcreatorsrv.cxx:268:73
>  (anonymous namespace)::TaskCreatorService::createInstanceWithArguments(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) framework/source/services/taskcreatorsrv.cxx:165:28
>  non-virtual thunk to (anonymous namespace)::TaskCreatorService::createInstanceWithArguments(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) framework/source/services/taskcreatorsrv.cxx:133:74
>  framework::TaskCreator::createTask(rtl::OUString const&) framework/source/classes/taskcreator.cxx:112:63
>  framework::Desktop::findFrame(rtl::OUString const&, int) framework/source/services/desktop.cxx:951:28
>  non-virtual thunk to framework::Desktop::findFrame(rtl::OUString const&, int) framework/source/services/desktop.cxx:920:61
>  framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1017:50
>  framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:379:20
>  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:165:14
>  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:597:12
>  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:583:64
>  (anonymous namespace)::LpSolverTest::setUp() sccomp/qa/unit/lpsolver.cxx:45:67
...

Change-Id: If46d9b82225a70caa9ad2f17fbeb99c6adc63990
üst 9130627e
--- src/hb-ot-font.cc
+++ src/hb-ot-font.cc
@@ -125,7 +125,7 @@
if (glyph >= this->num_advances)
glyph = this->num_advances - 1;
- return this->table->longMetric[glyph].advance;
+ return static_cast<OT::LongMetric const *>(this->table->longMetric)[glyph].advance;
}
};
--- src/hb-ot-map-private.hh
+++ src/hb-ot-map-private.hh
@@ -52,8 +52,11 @@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment