[Libreoffice-commits] core.git: vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 3 13:20:26 UTC 2021


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

New commits:
commit c4bc47a972383e6adc99ad1257c7a8ba207c57ba
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 2 10:23:37 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 3 15:19:53 2021 +0200

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

diff --git a/vcl/source/filter/ipict/ipict.cxx b/vcl/source/filter/ipict/ipict.cxx
index bcc61870726e..65e1f87221be 100644
--- a/vcl/source/filter/ipict/ipict.cxx
+++ b/vcl/source/filter/ipict/ipict.cxx
@@ -446,14 +446,11 @@ Color PictReader::ReadRGBColor()
     return Color( static_cast<sal_uInt8>( nR >> 8 ), static_cast<sal_uInt8>( nG >> 8 ), static_cast<sal_uInt8>( nB >> 8 ) );
 }
 
-
 void PictReader::ReadRectangle(tools::Rectangle & rRect)
 {
-    Point aTopLeft, aBottomRight;
-
-    aTopLeft=ReadPoint();
-    aBottomRight=ReadPoint();
-    if (aTopLeft.X() > aBottomRight.X() || aTopLeft.Y() > aBottomRight.Y())
+    Point aTopLeft = ReadPoint();
+    Point aBottomRight = ReadPoint();
+    if (!pPict->good() || aTopLeft.X() > aBottomRight.X() || aTopLeft.Y() > aBottomRight.Y())
     {
         SAL_WARN("filter.pict", "broken rectangle");
         pPict->SetError( SVSTREAM_FILEFORMAT_ERROR );
@@ -595,10 +592,9 @@ sal_uInt8 PictReader::ReadAndDrawArc(PictDrawingMethod eMethod)
 sal_uInt8 PictReader::ReadAndDrawSameArc(PictDrawingMethod eMethod)
 {
     short nstartAngle, narcAngle;
-    double fAng1, fAng2;
 
     pPict->ReadInt16( nstartAngle ).ReadInt16( narcAngle );
-    if (IsInvisible(eMethod)) return 4;
+    if (!pPict->good() || IsInvisible(eMethod)) return 4;
     DrawingMethod(eMethod);
 
     if (narcAngle<0) {
@@ -606,8 +602,8 @@ sal_uInt8 PictReader::ReadAndDrawSameArc(PictDrawingMethod eMethod)
         narcAngle=-narcAngle;
     }
     const double pi = 2 * acos(0.0);
-    fAng1 = static_cast<double>(nstartAngle) * pi / 180.0;
-    fAng2 = static_cast<double>(nstartAngle + narcAngle) * pi / 180.0;
+    double fAng1 = static_cast<double>(nstartAngle) * pi / 180.0;
+    double fAng2 = static_cast<double>(nstartAngle + narcAngle) * pi / 180.0;
     PictReaderShape::drawArc( pVirDev, eMethod == PictDrawingMethod::FRAME, aLastArcRect, fAng1, fAng2, nActPenSize );
     return 4;
 }


More information about the Libreoffice-commits mailing list