emfio/source/reader/wmfreader.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 885ef9d4d7ab9b725317c96dc09cd3914de47929
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Sep 6 08:48:45 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Sep 6 12:19:47 2021 +0200

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

diff --git a/emfio/source/reader/wmfreader.cxx 
b/emfio/source/reader/wmfreader.cxx
index 8799fab9898e..a32c7f100e04 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -1764,6 +1764,8 @@ namespace emfio
                             }
                         }
 
+                        bRecordOk &= pStm->good();
+
                         SAL_WARN_IF(!bRecordOk, "emfio", "polyline record 
claimed more points than the stream can provide");
 
                         if (!bRecordOk)
@@ -1801,7 +1803,7 @@ namespace emfio
 
                         SAL_WARN_IF(!bRecordOk, "emfio", "polypolygon record 
has more polygons than we can handle");
 
-                        bRecordOk = bRecordOk && pStm->good();
+                        bRecordOk &= pStm->good();
 
                         if (!bRecordOk)
                         {
@@ -1857,6 +1859,8 @@ namespace emfio
 
                         SAL_WARN_IF(!bRecordOk, "emfio", "polyline record 
claimed more points than the stream can provide");
 
+                        bRecordOk &= pStm->good();
+
                         if (!bRecordOk)
                         {
                             pStm->SetError( SVSTREAM_FILEFORMAT_ERROR );
@@ -1876,7 +1880,7 @@ namespace emfio
 
                     case W_META_TEXTOUT:
                     {
-                        sal_uInt16 nLength;
+                        sal_uInt16 nLength(0);
                         pStm->ReadUInt16( nLength );
                         // todo: we also have to take care of the text width
                         if ( nLength )
@@ -1890,7 +1894,7 @@ namespace emfio
 
                     case W_META_EXTTEXTOUT:
                     {
-                        sal_uInt16  nLen, nOptions;
+                        sal_uInt16 nLen(0), nOptions;
                         Point aPosition = ReadYX();
                         pStm->ReadUInt16( nLen ).ReadUInt16( nOptions );
                         // todo: we also have to take care of the text width
@@ -1942,7 +1946,7 @@ namespace emfio
 
                     case W_META_PATBLT:
                     {
-                        sal_uInt32 nROP;
+                        sal_uInt32 nROP(0);
                         pStm->ReadUInt32( nROP );
                         Size aSize = ReadYXExt();
                         GetWinExtMax( tools::Rectangle( ReadYX(), aSize ), 
aBound, nMapMode );

Reply via email to