vcl/source/outdev/text.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commits: commit f248b99b6f7f93b5170b4c50d7827fa0dd23421e Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon May 2 21:17:06 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue May 3 11:32:18 2022 +0200 ofz: Use-of-uninitialized-value Change-Id: I9ca24a135494a49449aec63615b2d945a93e8b27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133717 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 4b5e209b7680..b8b599cbc5ba 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1089,7 +1089,7 @@ void OutputDevice::GetCaretPositions( const OUString& rStr, sal_Int32* pCaretXAr for( i = 0; i < 2 * nLen; ++i ) if( pCaretXArray[ i ] >= 0 ) break; - tools::Long nXPos = pCaretXArray[ i ]; + tools::Long nXPos = (i < 2 * nLen) ? pCaretXArray[i] : -1; for( i = 0; i < 2 * nLen; ++i ) { if( pCaretXArray[ i ] >= 0 )