accessibility/source/extended/textwindowaccessibility.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
New commits: commit 1a1d67396c33fb768f67d9d1148de3ede205f25b Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Sat Oct 26 12:21:54 2024 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Oct 27 07:55:56 2024 +0100 tdf#163486: PVS: Array overrun is possible Change-Id: Ib4b0984d828927b67200acd24ce4a22f4b0e57e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175677 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 9021f85af610..a5c35ad4b056 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1004,15 +1004,15 @@ Document::retrieveCharacterAttributes( // sort the attributes auto nLength = static_cast<size_t>(aRes.getLength()); - std::unique_ptr<sal_Int32[]> pIndices( new sal_Int32[nLength] ); - std::iota(&pIndices[0], &pIndices[nLength], 0); - std::sort(&pIndices[0], &pIndices[nLength], + std::vector<sal_Int32> pIndices(nLength); + std::iota(pIndices.begin(), pIndices.end(), 0); + std::sort(pIndices.begin(), pIndices.end(), [&aRes](sal_Int32 a, sal_Int32 b) { return aRes[a].Name < aRes[b].Name; }); // create sorted sequences according to index array std::vector<css::beans::PropertyValue> aNewValues; aNewValues.reserve(nLength); - std::transform(&pIndices[0], &pIndices[nLength], std::back_inserter(aNewValues), + std::transform(pIndices.begin(), pIndices.end(), std::back_inserter(aNewValues), [&aRes](const sal_Int32 nIdx) -> const css::beans::PropertyValue& { return aRes[nIdx]; }); return comphelper::containerToSequence(aNewValues);