[Libreoffice-commits] core.git: 2 commits - emfio/source sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 30 18:23:32 UTC 2021


 emfio/source/reader/emfreader.cxx |   17 +++++++++++++++--
 sw/source/filter/ww8/ww8par.cxx   |    2 +-
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit f590bb806a8b439f595b84b624971bb6c1b89e6c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 30 12:45:16 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 30 20:23:14 2021 +0200

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

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 146de94a0230..e02df437f859 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3132,7 +3132,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp
             nUCode = nBCode;
         }
 
-        if (m_pStrm->GetError())
+        if (!m_pStrm->good())
         {
             rPos = WW8_CP_MAX-10; // -> eof or other error
             return true;
commit a0b5731dd6e8be9d61c5da2225512970f47a7c72
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 30 12:24:16 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 30 20:22:59 2021 +0200

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

diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 6e6893c8afb2..dc154228ac21 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1543,7 +1543,13 @@ namespace emfio
 
                                 // copy DIBInfoHeader from source (cbBmiSrc bytes)
                                 mpInputStream->Seek( nStart + offBmiSrc );
-                                mpInputStream->ReadBytes(pBuf + 14, cbBmiSrc);
+                                char* pWritePos = pBuf + 14;
+                                auto nRead = mpInputStream->ReadBytes(pWritePos, cbBmiSrc);
+                                if (nRead != cbBmiSrc)
+                                {
+                                    // zero remainder if short read
+                                    memset(pWritePos + nRead, 0, cbBmiSrc - nRead);
+                                }
 
                                 if (bReadAlpha)
                                 {
@@ -1555,7 +1561,14 @@ namespace emfio
 
                                 // copy bitmap data from source (offBitsSrc bytes)
                                 mpInputStream->Seek( nStart + offBitsSrc );
-                                mpInputStream->ReadBytes(pBuf + 14 + nDeltaToDIB5HeaderSize + cbBmiSrc, cbBitsSrc);
+                                pWritePos = pBuf + 14 + nDeltaToDIB5HeaderSize + cbBmiSrc;
+                                nRead = mpInputStream->ReadBytes(pWritePos, cbBitsSrc);
+                                if (nRead != cbBitsSrc)
+                                {
+                                    // zero remainder if short read
+                                    memset(pWritePos + nRead, 0, cbBitsSrc - nRead);
+                                }
+
                                 aTmp.Seek( 0 );
 
                                 // prepare to read and fill BitmapEx


More information about the Libreoffice-commits mailing list