vcl/source/filter/ipict/ipict.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 2e4ce586f95230e1e5cffd1d3349090877ce3afd
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Sep 6 16:16:56 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Sep 6 20:45:41 2021 +0200

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

diff --git a/vcl/source/filter/ipict/ipict.cxx 
b/vcl/source/filter/ipict/ipict.cxx
index d434763dd4be..cf9b2531e2c6 100644
--- a/vcl/source/filter/ipict/ipict.cxx
+++ b/vcl/source/filter/ipict/ipict.cxx
@@ -90,8 +90,7 @@ namespace PictReaderInternal {
   }
 
   sal_uInt8 Pattern::read(SvStream &stream) {
-    unsigned char nbyte[8];
-    sal_uInt32 nHiBytes, nLoBytes;
+    unsigned char nbyte[8] = {0};
     isColor = false;
 
     // count the no of bits in pattern which are set to 1:
@@ -99,16 +98,16 @@ namespace PictReaderInternal {
     for (unsigned char & ny : nbyte) {
       stream.ReadChar( reinterpret_cast<char&>(ny) );
       for (short nx=0; nx<8; nx++) {
-    if ( (ny & (1<<nx)) != 0 ) nBitCount++;
+        if ( (ny & (1<<nx)) != 0 ) nBitCount++;
       }
     }
 
     // store pattern in 2 long words:
-    nHiBytes=(((((static_cast<sal_uInt32>(nbyte[0])<<8)|
+    sal_uInt32 nHiBytes = (((((static_cast<sal_uInt32>(nbyte[0])<<8)|
          static_cast<sal_uInt32>(nbyte[1]))<<8)|
            static_cast<sal_uInt32>(nbyte[2]))<<8)|
       static_cast<sal_uInt32>(nbyte[3]);
-    nLoBytes=(((((static_cast<sal_uInt32>(nbyte[4])<<8)|
+    sal_uInt32 nLoBytes = (((((static_cast<sal_uInt32>(nbyte[4])<<8)|
          static_cast<sal_uInt32>(nbyte[5]))<<8)|
            static_cast<sal_uInt32>(nbyte[6]))<<8)|
       static_cast<sal_uInt32>(nbyte[7]);

Reply via email to