accessibility/source/extended/textwindowaccessibility.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
New commits: commit 433eb742c0ff81ff568e4a5f469a6ad4c827b8f5 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Sat Oct 26 09:54:00 2024 +0200 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Sat Oct 26 11:13:24 2024 +0200 tdf#163486: PVS: Array overrun is possible Change-Id: I53c32af196caabb6084936eb4dd7f360b6226782 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175672 Reviewed-by: Julien Nabet <serval2...@yahoo.fr> Tested-by: Jenkins diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 9021f85af610..6f80a7a8f86f 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1005,14 +1005,14 @@ 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::iota(&pIndices[0], &pIndices[nLength-1], 0); + std::sort(&pIndices[0], &pIndices[nLength-1], [&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[0], &pIndices[nLength-1], std::back_inserter(aNewValues), [&aRes](const sal_Int32 nIdx) -> const css::beans::PropertyValue& { return aRes[nIdx]; }); return comphelper::containerToSequence(aNewValues);