[Libreoffice-commits] core.git: sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 19 09:02:20 UTC 2019
sc/source/ui/inc/drawview.hxx | 2 +-
sc/source/ui/view/drawview.cxx | 4 ++--
sc/source/ui/view/viewfun7.cxx | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
New commits:
commit 416e9ecac90447581825355b772fe722d012b282
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jul 18 11:59:49 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jul 19 11:01:39 2019 +0200
cid#1448217 Use after free
Change-Id: Icb7700c701dd8e9b23bfe29bbedf27ddd9c8f0a1
Reviewed-on: https://gerrit.libreoffice.org/75911
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 5a79b95cc60a..46f5598705f2 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -117,7 +117,7 @@ public:
bool HasMarkedControl() const;
bool HasMarkedInternal() const;
- void InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV);
+ bool InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV);
/** Returns the selected object, if it is the caption object of a cell note.
@param ppCaptData (out-param) If not null, returns the pointer to the caption object data. */
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 273431ef0bf5..c2a4dfe58144 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -804,7 +804,7 @@ bool ScDrawView::GetObjectIsMarked( const SdrObject* pObject )
return bisMarked;
}
-void ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV)
+bool ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV)
{
SdrInsertFlags nOptions=SdrInsertFlags::NONE;
// Do not change marks when the ole object is active
@@ -817,7 +817,7 @@ void ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV)
nOptions |= SdrInsertFlags::DONTMARK;
}
- InsertObjectAtView( pObj, rPV, nOptions );
+ return InsertObjectAtView(pObj, rPV, nOptions);
}
SdrObject* ScDrawView::GetMarkedNoteCaption( ScDrawObjData** ppCaptData )
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index b128516379ff..21ccfc3848a9 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -447,15 +447,15 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
pGrafObj->SetName(aName);
// don't mark if OLE
- pScDrawView->InsertObjectSafe(pGrafObj, *pScDrawView->GetSdrPageView());
+ bool bSuccess = pScDrawView->InsertObjectSafe(pGrafObj, *pScDrawView->GetSdrPageView());
// SetGraphicLink has to be used after inserting the object,
// otherwise an empty graphic is swapped in and the contact stuff crashes.
// See #i37444#.
- if (!rFile.isEmpty())
+ if (bSuccess && !rFile.isEmpty())
pGrafObj->SetGraphicLink( rFile, ""/*TODO?*/, rFilter );
- return true;
+ return bSuccess;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list