Fix stack-use-after-scope

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 10 May 2022 07:32 UTC

...during CppunitTest_chart2_export,

> [_RUN_____] testStrict::Load_Verify_Reload_Verify [...] > ==20402==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7f220d8280d0 at pc 0x7f21a71c55cb bp 0x7ffc70fff650 sp 0x7ffc70fff648 > READ of size 8 at 0x7f220d8280d0 thread T0 > #0 0x7f21a71c55ca in sdr::contact::ViewObjectContact::getPrimitive2DSequence(sdr::contact::DisplayInfo const&) const /svx/source/sdr/contact/viewobjectcontact.cxx:361:22 > #1 0x7f21a71c440f in sdr::contact::ViewObjectContact::getObjectRange() const /svx/source/sdr/contact/viewobjectcontact.cxx:199:78 > #2 0x7f21a71c33f7 in sdr::contact::ViewObjectContact::~ViewObjectContact() /svx/source/sdr/contact/viewobjectcontact.cxx:165:9 > #3 0x7f21a71d0af8 in sdr::contact::ViewObjectContactOfSdrObj::~ViewObjectContactOfSdrObj() /svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx:51:1 > #4 0x7f21a70b6d08 in sdr::contact::ViewObjectContactOfGroup::~ViewObjectContactOfGroup() /svx/source/sdr/contact/viewobjectcontactofgroup.cxx:40:9 > #5 0x7f21a70b6d58 in sdr::contact::ViewObjectContactOfGroup::~ViewObjectContactOfGroup() /svx/source/sdr/contact/viewobjectcontactofgroup.cxx:39:9 > #6 0x7f21a71315e1 in sdr::contact::ObjectContact::~ObjectContact() /svx/source/sdr/contact/objectcontact.cxx:68:9 > #7 0x7f21a71e7108 in sdr::contact::ObjectContactPainter::~ObjectContactPainter() /svx/source/sdr/contact/objectcontactofobjlistpainter.cxx:43:1 > #8 0x7f21a71e77fc in sdr::contact::ObjectContactOfObjListPainter::~ObjectContactOfObjListPainter() /svx/source/sdr/contact/objectcontactofobjlistpainter.cxx:69:1 > #9 0x7f21a89793c1 in (anonymous namespace)::GraphicExporter::GetGraphic((anonymous namespace)::ExportSettings const&, Graphic&, bool) /svx/source/unodraw/UnoGraphicExporter.cxx:959:13 [...] > Address 0x7f220d8280d0 is located in stack of thread T0 at offset 4304 in frame > #0 0x7f21a896d04f in (anonymous namespace)::GraphicExporter::GetGraphic((anonymous namespace)::ExportSettings const&, Graphic&, bool) /svx/source/unodraw/UnoGraphicExporter.cxx:592 > > This frame has 89 object(s): [...] > [4304, 4320) 'aCheckVisibilityRedirector' (line 955) <== Memory access at offset 4304 is inside this variable

(), presumably since db6c5c7f9dddd81a8f18a74d6051555680837adc "svx: calculate object range before using it"

Change-Id: I77d56be1ca6bf16a0f5aa65cc1130547ae2fbf04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134103

f522000d1561 Fix stack-use-after-scope
svx/source/unodraw/UnoGraphicExporter.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share