From 967717e65fffce20ff6069c2177720c067e174d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 12 Apr 2022 08:45:23 +0100 Subject: [PATCH] ofz: Use-of-uninitialized-value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I87cfad2da9b90bc4487dc4deb2fda5bb31a6b763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132888 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/outdev/text.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 14e3aed21a97..522fd348c7ee 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1779,7 +1779,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 const pCaretXArray(new sal_Int32[2 * aStr.getLength()]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() );