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

Caolán McNamara caolanm at redhat.com
Sat Mar 18 12:38:45 UTC 2017


 sd/source/filter/ppt/propread.cxx |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 23a7498fddf5b0f042deeede63c60334c06b787b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 18 12:35:54 2017 +0000

    valgrind: uninitialized value
    
    and can use a simple vector here
    
    Change-Id: If27e881c4ae7a1a068fdbb1c0a689ecc78804095

diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 8eb2daf523e2..ae515dd84a49 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -569,26 +569,25 @@ void PropRead::Read()
 
     if ( mbStatus )
     {
-        sal_uInt32  nSections;
-        sal_uInt32  nSectionOfs;
-        sal_uInt32  nCurrent;
         mpSvStream->ReadUInt16( mnByteOrder ).ReadUInt16( mnFormat ).ReadUInt16( mnVersionLo ).ReadUInt16( mnVersionHi );
         if ( mnByteOrder == 0xfffe )
         {
-            std::unique_ptr<sal_uInt8[]> pSectCLSID( new sal_uInt8[ 16 ] );
+            std::vector<sal_uInt8> aSectCLSID(16);
             mpSvStream->ReadBytes(mApplicationCLSID, 16);
-            mpSvStream->ReadUInt32( nSections );
+            sal_uInt32 nSections(0);
+            mpSvStream->ReadUInt32(nSections);
             if ( nSections > 2 )                // sj: PowerPoint documents are containing max 2 sections
             {
                 mbStatus = false;
             }
             else for ( sal_uInt32 i = 0; i < nSections; i++ )
             {
-                mpSvStream->ReadBytes(pSectCLSID.get(), 16);
+                mpSvStream->ReadBytes(aSectCLSID.data(), aSectCLSID.size());
+                sal_uInt32 nSectionOfs(0);
                 mpSvStream->ReadUInt32( nSectionOfs );
-                nCurrent = mpSvStream->Tell();
+                sal_uInt32 nCurrent = mpSvStream->Tell();
                 mpSvStream->Seek( nSectionOfs );
-                Section aSection( pSectCLSID.get() );
+                Section aSection(aSectCLSID.data());
                 aSection.Read( mpSvStream.get() );
                 maSections.push_back( o3tl::make_unique<Section>( aSection ) );
                 mpSvStream->Seek( nCurrent );


More information about the Libreoffice-commits mailing list