summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-10 09:58:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-10 16:40:41 +0100
commitd64f6caf22715fb421f4b89820c0842b7cae6905 (patch)
tree453ae0e13053cbef50f8d92c928f85ca5d5e8a5e
parent4dba9820cf44718121a38b3f89eb8caa244d7321 (diff)
ofz#4163 Null-dereference READ
Change-Id: I3d1ae5f55343b1b8ec3b0d79a56c9368385a0af8 Reviewed-on: https://gerrit.libreoffice.org/44581 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--editeng/source/editeng/editeng.cxx2
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx4
2 files changed, 4 insertions, 2 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index bb09af238d99..3e3b691d207b 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1492,6 +1492,8 @@ EditTextObject* EditEngine::CreateTextObject()
EditTextObject* EditEngine::CreateTextObject( const ESelection& rESelection )
{
EditSelection aSel( pImpEditEngine->CreateSel( rESelection ) );
+ if (aSel.IsInvalid())
+ return nullptr;
return pImpEditEngine->CreateTextObject( aSel );
}
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index f84cc987ef8d..cac30a4db058 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -400,10 +400,10 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
mpDoc->SetString(nCol, nRow, nTab, aStr, &aParam);
}
}
- else
+ else if (EditTextObject* pTextObject = mpEngine->CreateTextObject(pE->aSel))
{
// The cell will own the text object instance.
- mpDoc->SetEditText(ScAddress(nCol,nRow,nTab), mpEngine->CreateTextObject(pE->aSel));
+ mpDoc->SetEditText(ScAddress(nCol,nRow,nTab), pTextObject);
}
if ( !pE->maImageList.empty() )
bHasGraphics |= GraphicSize( nCol, nRow, pE );