Skip to content

Commit cb7420e

Browse files
caolanms8321414
authored andcommitted
apparent use-after-free of ScLOKProxyObjectContact::mpScDrawView
#0 std::vector<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow> >, std::allocator<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow> > > >::size (this=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:987 #1 SdrPageView::PageWindowCount (this=<optimized out>) at include/svx/svdpagv.hxx:89 #2 (anonymous namespace)::ScLOKProxyObjectContact::calculateGridOffsetForViewObjectContact (this=<optimized out>, rTarget=..., rClient=...) at sc/source/ui/view/gridwin4.cxx:1467 #3 0x00007fe8eae62e05 in sdr::contact::ViewObjectContact::getGridOffset (this=this@entry=0x364bdc60) at include/svx/sdr/contact/viewobjectcontact.hxx:95 #4 0x00007fe8eae642fe in sdr::contact::ViewObjectContact::getPrimitive2DSequence (this=this@entry=0x364bdc60, rDisplayInfo=...) at svx/source/sdr/contact/viewobjectcontact.cxx:487 #5 0x00007fe8eae645b1 in sdr::contact::ViewObjectContact::getObjectRange (this=this@entry=0x364bdc60) at svx/source/sdr/contact/viewobjectcontact.cxx:209 #6 0x00007fe8eae64832 in sdr::contact::ViewObjectContact::triggerLazyInvalidate (this=0x364bdc60) at svx/source/sdr/contact/viewobjectcontact.cxx:273 #7 0x00007fe8eae65415 in sdr::contact::ObjectContactOfPageView::Invoke (this=0x7fe8a8103ff0) at svx/source/sdr/contact/objectcontactofpageview.cxx:105 #8 0x00007fe8ebb2b30b in Scheduler::CallbackTaskScheduling () at vcl/source/app/scheduler.cxx:579 #9 0x00007fe8ebceb21b in SvpSalInstance::StartTimer (nMS=<optimized out>, this=0x2e01000000000000) Change-Id: Icb71083eb77e528d9025aa7a591892dcdfc2ba89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185019 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185026
1 parent bb1f156 commit cb7420e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sc/source/ui/view/gridwin4.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <vcl/settings.hxx>
3333
#include <o3tl/unit_conversion.hxx>
3434
#include <osl/diagnose.h>
35+
#include <tools/weakbase.hxx>
3536

3637
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
3738
#include <comphelper/lok.hxx>
@@ -1406,15 +1407,15 @@ namespace
14061407
class ScLOKProxyObjectContact final : public sdr::contact::ObjectContactOfPageView
14071408
{
14081409
private:
1409-
ScDrawView* mpScDrawView;
1410+
tools::WeakReference<ScDrawView> m_xScDrawView;
14101411

14111412
public:
14121413
explicit ScLOKProxyObjectContact(
14131414
ScDrawView* pDrawView,
14141415
SdrPageWindow& rPageWindow,
14151416
const char* pDebugName) :
14161417
ObjectContactOfPageView(rPageWindow, pDebugName),
1417-
mpScDrawView(pDrawView)
1418+
m_xScDrawView(pDrawView)
14181419
{
14191420
}
14201421

@@ -1424,10 +1425,11 @@ namespace
14241425
basegfx::B2DVector& rTarget,
14251426
const sdr::contact::ViewObjectContact& rClient) const override
14261427
{
1427-
if (!mpScDrawView)
1428+
ScDrawView* pScDrawView = m_xScDrawView.get();
1429+
if (!pScDrawView)
14281430
return;
14291431

1430-
SdrPageView* pPageView(mpScDrawView->GetSdrPageView());
1432+
SdrPageView* pPageView(pScDrawView->GetSdrPageView());
14311433
if (!pPageView)
14321434
return;
14331435

0 commit comments

Comments
 (0)