vcl/source/outdev/text.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit be364e3c211b74899b9e0007ce22e8ef659d003d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Mar 6 14:34:26 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Mar 6 16:40:32 2022 +0100

    ofz: Use-of-uninitialized-value
    
    Change-Id: I1f1771c384e88417f40ea9dd76378fb057e3d977
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131075
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 3d773e56d488..b929fb294cd8 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1080,7 +1080,10 @@ void OutputDevice::GetCaretPositions( const OUString& 
rStr, sal_Int32* pCaretXAr
     std::unique_ptr<SalLayout> pSalLayout = ImplLayout(rStr, nIndex, nLen, 
Point(0, 0), 0, {},
                                                        eDefaultLayout, 
nullptr, pGlyphs);
     if( !pSalLayout )
+    {
+        std::fill(pCaretXArray, pCaretXArray + nLen * 2, -1);
         return;
+    }
 
     int nWidthFactor = pSalLayout->GetUnitsPerPixel();
     pSalLayout->GetCaretPositions( 2*nLen, pCaretXArray );

Reply via email to