vcl/source/filter/imet/ios2met.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 148d2ffe35cae2fe758a3eb68ffd3ed81e2a8dd1
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Sep 5 15:07:23 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Sep 5 20:48:58 2021 +0200

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

diff --git a/vcl/source/filter/imet/ios2met.cxx 
b/vcl/source/filter/imet/ios2met.cxx
index e767cccc047b..edf0bb95293f 100644
--- a/vcl/source/filter/imet/ios2met.cxx
+++ b/vcl/source/filter/imet/ios2met.cxx
@@ -1009,7 +1009,7 @@ void OS2METReader::ReadBitBlt()
 void OS2METReader::ReadChrStr(bool bGivenPos, bool bMove, bool bExtra, 
sal_uInt16 nOrderLen)
 {
     Point aP0;
-    sal_uInt16 i, nLen;
+    sal_uInt16 nLen;
     OSFont * pF;
     vcl::Font aFont;
     Size aSize;
@@ -1043,10 +1043,10 @@ void OS2METReader::ReadChrStr(bool bGivenPos, bool 
bMove, bool bExtra, sal_uInt1
         else
             nLen = nOrderLen-4;
     }
-    if (nLen > pOS2MET->remainingSize())
+    if (!pOS2MET->good() || nLen > pOS2MET->remainingSize())
         throw css::uno::Exception("attempt to read past end of input", 
nullptr);
     std::unique_ptr<char[]> pChr(new char[nLen+1]);
-    for (i=0; i<nLen; i++)
+    for (sal_uInt16 i=0; i<nLen; i++)
         pOS2MET->ReadChar( pChr[i] );
     pChr[nLen] = 0;
     OUString aStr( pChr.get(), strlen(pChr.get()), osl_getThreadTextEncoding() 
);

Reply via email to