vcl/source/filter/ipict/ipict.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit afe9c271859254025cc06f26cd565232025dbc73
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Sep 4 10:22:13 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Sep 4 12:15:11 2021 +0200

    ofz: MemorySanitizer: use-of-uninitialized-value
    
    Change-Id: Id576a38ed93b3ac0c3d1e886b65c7c13ced129aa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121629
    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 13b2b7eb7d55..8c9494c36448 100644
--- a/vcl/source/filter/ipict/ipict.cxx
+++ b/vcl/source/filter/ipict/ipict.cxx
@@ -418,9 +418,9 @@ Size PictReader::ReadSize()
 
 Color PictReader::ReadColor()
 {
-    sal_uInt32 nCol;
     Color aCol;
 
+    sal_uInt32 nCol(0);
     pPict->ReadUInt32( nCol );
     switch (nCol)
     {
@@ -437,7 +437,6 @@ Color PictReader::ReadColor()
     return aCol;
 }
 
-
 Color PictReader::ReadRGBColor()
 {
     sal_uInt16 nR, nG, nB;
@@ -1525,6 +1524,9 @@ sal_uInt64 PictReader::ReadData(sal_uInt16 nOpcode)
         aPoint=ReadPoint(); aPenPosition=ReadPoint();
         nDataSize=8;
 
+        if (!pPict->good())
+            break;
+
         if (IsInvisible( PictDrawingMethod::FRAME )) break;
         DrawingMethod( PictDrawingMethod::FRAME );
         PictReaderShape::drawLine(pVirDev, aPoint,aPenPosition, nActPenSize);
@@ -1534,6 +1536,9 @@ sal_uInt64 PictReader::ReadData(sal_uInt16 nOpcode)
         aPoint=aPenPosition; aPenPosition=ReadPoint();
         nDataSize=4;
 
+        if (!pPict->good())
+            break;
+
         if (IsInvisible( PictDrawingMethod::FRAME )) break;
         DrawingMethod( PictDrawingMethod::FRAME );
         PictReaderShape::drawLine(pVirDev, aPoint,aPenPosition, nActPenSize);
@@ -1545,6 +1550,9 @@ sal_uInt64 PictReader::ReadData(sal_uInt16 nOpcode)
         aPenPosition=ReadDeltaV(aPenPosition);
         nDataSize=6;
 
+        if (!pPict->good())
+            break;
+
         if ( IsInvisible(PictDrawingMethod::FRAME) ) break;
         DrawingMethod( PictDrawingMethod::FRAME );
         PictReaderShape::drawLine(pVirDev, aPoint,aPenPosition, nActPenSize);

Reply via email to