vcl/win/window/salframe.cxx |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit cf2d3776e1b0ca15d6e358ba8b9622b97754e38e
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Oct 3 15:13:10 2025 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 3 16:53:18 2025 +0200

    Correctly zero-initialize the buffer
    
    It went wrong in commit 63ba54a168dbc777cdcec2393be476bdd5f79bc1
    (convert EXTTEXTINPUT_ATTR to scoped enum, 2016-05-11), which changed
    the type of elements (and their size) in new, but didn't change memset
    accordingly.
    
    Since only up to nAttrLen elements are set in the buffer in the loop,
    it could end up containing garbage.
    
    Change-Id: I085231dac739d92c2e13c9cb5cf679591691612a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191822
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 76572eb4fa08..ebbd3c468fed 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5269,8 +5269,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* 
pFrame,
             if ( pAttrBuf )
             {
                 sal_Int32 nTextLen2 = aEvt.maText.getLength();
-                pSalAttrAry.reset(new ExtTextInputAttr[nTextLen2]);
-                memset( pSalAttrAry.get(), 0, nTextLen2*sizeof( sal_uInt16 ) );
+                pSalAttrAry = std::make_unique<ExtTextInputAttr[]>(nTextLen2); 
// zero-initialize
                 for( sal_Int32 i = 0; (i < nTextLen2) && (i < nAttrLen); i++ )
                 {
                     BYTE nWinAttr = pAttrBuf.get()[i];

Reply via email to