[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source

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


 vcl/source/filter/ipsd/ipsd.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit da35f7f3137439b6138d7919111dbaeee0d0b327
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Aug 28 10:18:57 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Aug 30 14:05:49 2021 +0200

    ofz: MemorySanitizer: use-of-uninitialized-value
    
    Change-Id: Id3acc87a697a61bcf3794745846071bc99fc8d8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121157
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/vcl/source/filter/ipsd/ipsd.cxx b/vcl/source/filter/ipsd/ipsd.cxx
index 623a2b14a84e..4c12770275fe 100644
--- a/vcl/source/filter/ipsd/ipsd.cxx
+++ b/vcl/source/filter/ipsd/ipsd.cxx
@@ -616,7 +616,7 @@ bool PSDReader::ImplReadBody()
             if (mpFileHeader->nMode == PSD_CMYK && m_rPSD.good())
             {
                 sal_uInt32  nBlack, nBlackMax = 0;
-                std::unique_ptr<sal_uInt8[]> pBlack(new sal_uInt8[ mpFileHeader->nRows * mpFileHeader->nColumns ]);
+                std::vector<sal_uInt8> aBlack(mpFileHeader->nRows * mpFileHeader->nColumns, 0);
                 nY = 0;
                 while (nY < mpFileHeader->nRows && m_rPSD.good())
                 {
@@ -645,7 +645,7 @@ bool PSDReader::ImplReadBody()
                             nBlack = mpBitmap->GetPixel( nY, nX ).GetBlue() + nDat;
                             if ( nBlack > nBlackMax )
                                 nBlackMax = nBlack;
-                            pBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff;
+                            aBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff;
                             if ( ++nX == mpFileHeader->nColumns )
                             {
                                 nX = 0;
@@ -672,7 +672,7 @@ bool PSDReader::ImplReadBody()
                             nBlack = mpBitmap->GetPixel( nY, nX ).GetBlue() + nDat;
                             if ( nBlack > nBlackMax )
                                 nBlackMax = nBlack;
-                            pBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff;
+                            aBlack[ nX + nY * mpFileHeader->nColumns ] = nDat ^ 0xff;
                             if ( ++nX == mpFileHeader->nColumns )
                             {
                                 nX = 0;
@@ -688,7 +688,7 @@ bool PSDReader::ImplReadBody()
                 {
                     for ( nX = 0; nX < mpFileHeader->nColumns; nX++ )
                     {
-                        sal_Int32 nDAT = pBlack[ nX + nY * mpFileHeader->nColumns ] * ( nBlackMax - 256 ) / 0x1ff;
+                        sal_Int32 nDAT = aBlack[ nX + nY * mpFileHeader->nColumns ] * ( nBlackMax - 256 ) / 0x1ff;
 
                         aBitmapColor = mpBitmap->GetPixel( nY, nX );
                         sal_uInt8 cR = static_cast<sal_uInt8>(MinMax( aBitmapColor.GetRed() - nDAT, 0, 255L ));


More information about the Libreoffice-commits mailing list