vcl/source/outdev/text.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commits: commit 583d162b54320244f0ce250876e196ccca8983ee Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Apr 12 08:45:23 2022 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Apr 12 11:57:09 2022 +0200 ofz: Use-of-uninitialized-value Change-Id: I87cfad2da9b90bc4487dc4deb2fda5bb31a6b763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132856 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 a28dc49e5ebd..4b5e209b7680 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1738,7 +1738,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta tools::Long nMnemonicX = 0; tools::Long nMnemonicY = 0; DeviceCoordinate nMnemonicWidth = 0; - if ( nMnemonicPos != -1 ) + if (nMnemonicPos != -1 && nMnemonicPos < aStr.getLength()) { std::unique_ptr<sal_Int32[]> const pCaretXArray(new sal_Int32[2 * aStr.getLength()]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() );