diff options
author | Patrick Luby <plubius@neooffice.org> | 2023-07-31 20:03:13 -0400 |
---|---|---|
committer | Patrick Luby <plubius@neooffice.org> | 2023-08-01 14:27:49 +0200 |
commit | 01a1d2a84992973b8a0e5f1ae99fd32f5913b58f (patch) | |
tree | f1997c20f6037588565082696c5f51c94d21ceef /reportdesign/source | |
parent | 0004de149269ed2ab5423947b9930653f3da6038 (diff) |
tdf#144072 prevent use of a deleted pointer
BegDragObj_createInvisibleObjectAtPosition() may clear the handle
list and that will delete the SdrHdl instances owned by this section
view so set _pHdl to null if it has been deleted during the call.
Change-Id: I89606958f8a76a2c35685d1aff6b0159739a464a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155119
Tested-by: Jenkins
Reviewed-by: Patrick Luby <plubius@neooffice.org>
Diffstat (limited to 'reportdesign/source')
-rw-r--r-- | reportdesign/source/ui/report/ViewsWindow.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index e11735bf72ca..a5ad82e818e2 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1043,7 +1043,21 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi "createInvisible X:" << aRect.Left() << " Y:" << aRect.Top() << " on View #" << nViewCount); + // tdf#144072 prevent use of a deleted pointer + // BegDragObj_createInvisibleObjectAtPosition() may clear + // the handle list and that will delete the SdrHdl instances + // owned by this section view so set _pHdl to null if it has + // been deleted during the call. + bool bHdlInList = false; + const SdrHdlList& rHdlList = rView.GetHdlList(); + if (_pHdl && rHdlList.GetHdlNum(_pHdl) < rHdlList.GetHdlCount()) + bHdlInList = true; BegDragObj_createInvisibleObjectAtPosition(aRect, rView); + if (bHdlInList && rHdlList.GetHdlNum(_pHdl) >= rHdlList.GetHdlCount()) + { + SAL_WARN("reportdesign", "SdrHdl pointer parameter has been deleted"); + _pHdl = nullptr; + } } } } |