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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 1 07:30:12 UTC 2021


 vcl/source/filter/itga/itga.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 648d0c21a1f78074c7119dfcc672f20cc5cf03b1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Aug 31 12:50:11 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Sep 1 09:29:39 2021 +0200

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

diff --git a/vcl/source/filter/itga/itga.cxx b/vcl/source/filter/itga/itga.cxx
index e668839ebab7..6b3b3037fe24 100644
--- a/vcl/source/filter/itga/itga.cxx
+++ b/vcl/source/filter/itga/itga.cxx
@@ -305,13 +305,13 @@ bool TGAReader::ImplReadBody()
                         if ( nRunCount & 0x80 )     // a run length packet
                         {
                             m_rTGA.ReadUInt16( nRGB16 );
+                            if (!m_rTGA.good())
+                                return false;
                             if ( nRGB16 >= mpFileHeader->nColorMapLength )
                                 return false;
                             nRed = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 16 );
                             nGreen = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 8 );
                             nBlue = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] );
-                            if ( !m_rTGA.good())
-                                return false;
                             for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
                             {
                                 mpBitmap->SetPixel( nY, nX, Color( nRed, nGreen, nBlue ) );
@@ -396,7 +396,6 @@ bool TGAReader::ImplReadBody()
                         {
                             for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
                             {
-
                                 m_rTGA.ReadUChar( nDummy );
                                 if ( !m_rTGA.good())
                                     return false;


More information about the Libreoffice-commits mailing list