sd/source/ui/slidesorter/controller/SlsClipboard.cxx | 2 - sw/source/core/access/accpara.cxx | 29 +++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-)
New commits: commit b83a373586b5e6772c643162d3213cd33e4fdffb Author: Caolán McNamara <caol...@redhat.com> Date: Thu Mar 29 09:40:08 2018 +0100 coverity#1433646 Dereference after null check Change-Id: Ie3a352551a82656939c7d25b7f922a03b80d232b Reviewed-on: https://gerrit.libreoffice.org/52061 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index f9666f300961..3c68d26836c8 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -383,7 +383,7 @@ void Clipboard::CreateSlideTransferable ( (model::PageEnumerationProvider::CreateSelectedPagesEnumeration( mrSlideSorter.GetModel())); SdDrawDocument* const pDocument = mrSlideSorter.GetModel().GetDocument(); - DrawDocShell* const pDataDocSh = pDocument ? pDocument->GetDocSh() : nullptr; + DrawDocShell* const pDataDocSh = pDocument->GetDocSh(); sal_Int32 nUniqueID = 0; while (aSelectedPages.HasMoreElements()) commit 201dc4c43a05098662a31cd338da61b9e47a1e01 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Mar 29 09:46:39 2018 +0100 coverity#1433645 silence Out-of-bounds read Change-Id: Ie098ea6fd2b36e8bc6173f3ca69f2ffc5e312533 Reviewed-on: https://gerrit.libreoffice.org/52062 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index ecc08ddac942..1b98c75b0f81 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1633,16 +1633,17 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes( //sort property values // build sorted index array sal_Int32 nLength = aValues.size(); - std::unique_ptr<sal_Int32[]> pIndices( new sal_Int32[nLength] ); - for( i = 0; i < nLength; i++ ) - pIndices[i] = i; - sort( &pIndices[0], &pIndices[nLength], IndexCompare(aValues.data()) ); + std::vector<sal_Int32> aIndices; + aIndices.reserve(nLength); + for (i = 0; i < nLength; ++i) + aIndices.push_back(i); + std::sort(aIndices.begin(), aIndices.end(), IndexCompare(aValues.data())); // create sorted sequences according to index array uno::Sequence<PropertyValue> aNewValues( nLength ); PropertyValue* pNewValues = aNewValues.getArray(); - for( i = 0; i < nLength; i++ ) + for (i = 0; i < nLength; ++i) { - pNewValues[i] = aValues[pIndices[i]]; + pNewValues[i] = aValues[aIndices[i]]; } return aNewValues; } @@ -2848,24 +2849,24 @@ sal_Bool SwAccessibleParagraph::setAttributes( // build sorted index array sal_Int32 nLength = rAttributeSet.getLength(); const PropertyValue* pPairs = rAttributeSet.getConstArray(); - sal_Int32* pIndices = new sal_Int32[nLength]; - sal_Int32 i; - for( i = 0; i < nLength; i++ ) - pIndices[i] = i; - sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) ); + std::vector<sal_Int32> aIndices; + aIndices.reserve(nLength); + for (sal_Int32 i = 0; i < nLength; ++i) + aIndices.push_back(i); + std::sort(aIndices.begin(), aIndices.end(), IndexCompare(pPairs)); // create sorted sequences according to index array uno::Sequence< OUString > aNames( nLength ); OUString* pNames = aNames.getArray(); uno::Sequence< uno::Any > aValues( nLength ); uno::Any* pValues = aValues.getArray(); - for( i = 0; i < nLength; i++ ) + for (sal_Int32 i = 0; i < nLength; ++i) { - const PropertyValue& rVal = pPairs[pIndices[i]]; + const PropertyValue& rVal = pPairs[aIndices[i]]; pNames[i] = rVal.Name; pValues[i] = rVal.Value; } - delete[] pIndices; + aIndices.clear(); // now set the values bool bRet = true; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits