[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/qa sd/source

Caolán McNamara caolanm at redhat.com
Sat Aug 29 01:14:50 PDT 2015


 sd/qa/unit/data/ppt/pass/hang-20.ppt |binary
 sd/source/filter/ppt/pptin.cxx       |   34 +++++++++++++++++++++++++---------
 2 files changed, 25 insertions(+), 9 deletions(-)

New commits:
commit 062bb3675bf05e5a8150bddb7b4c0e404961fa13
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 28 16:14:07 2015 +0100

    check stream status
    
    Change-Id: I609c8c4f4e843601361b61f55e0325ad99db3c23
    (cherry picked from commit dc1be62d75e654e17c2f4c02804b7fd48d5a2515)
    Reviewed-on: https://gerrit.libreoffice.org/18115
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/sd/qa/unit/data/ppt/pass/hang-20.ppt b/sd/qa/unit/data/ppt/pass/hang-20.ppt
new file mode 100644
index 0000000..7bfe75d
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-20.ppt differ
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 3cb8d80..dc4cadd 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -279,7 +279,6 @@ bool ImplSdPPTImport::Import()
                     if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) )
                     {
                         sal_uInt32  nSlideTitleIndex = 0, nSlideTitleCount = 0;
-                        sal_uInt32  i, nTemp;
 
                         OUString aUString;
 
@@ -290,13 +289,14 @@ bool ImplSdPPTImport::Import()
                         {
                             nVecCount >>= 1;
                             sal_uInt32 nEntryCount = 0;
-                            for ( i = 0; i < nVecCount; i++ )
+                            for (sal_uInt32 i = 0; i < nVecCount; ++i)
                             {
                                 if ( !aPropItem.Read( aUString, VT_EMPTY, false ) )
                                     break;
                                 aPropItem.ReadUInt32( nType );
                                 if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) )
                                     break;
+                                sal_uInt32 nTemp(0);
                                 aPropItem.ReadUInt32( nTemp );
                                 if ( aUString == "Slide Titles" || aUString == "Folientitel" )
                                 {
@@ -311,17 +311,33 @@ bool ImplSdPPTImport::Import()
                             aPropItem.ReadUInt32( nType )
                                      .ReadUInt32( nVecCount );
 
-                            if ( ( nVecCount >= ( nSlideTitleIndex + nSlideTitleCount ) )
-                                    && ( nType == ( VT_LPSTR | VT_VECTOR ) ) )
+                            bool bVecOk = ( ( nVecCount >= (nSlideTitleIndex + nSlideTitleCount) )
+                                    && ( nType == ( VT_LPSTR | VT_VECTOR ) ) );
+
+                            if (bVecOk)
                             {
-                                for ( i = 0; i != nSlideTitleIndex; i++ )
+                                for (sal_uInt32 i = 0; i != nSlideTitleIndex; ++i)
                                 {
-                                    aPropItem.ReadUInt32( nTemp );
-                                    aPropItem.SeekRel( nTemp );
+                                    sal_uInt32 nTemp(0);
+                                    aPropItem.ReadUInt32(nTemp);
+                                    if (!aPropItem.good())
+                                    {
+                                        bVecOk = false;
+                                        break;
+                                    }
+                                    auto nPos = aPropItem.Tell() + nTemp;
+                                    if (nPos != aPropItem.Seek(nPos))
+                                    {
+                                        bVecOk = false;
+                                        break;
+                                    }
                                 }
-                                for ( i = 0; i < nSlideTitleCount; i++ )
+                            }
+                            if (bVecOk)
+                            {
+                                for (sal_uInt32 i = 0; i < nSlideTitleCount; ++i)
                                 {
-                                    if ( !aPropItem.Read( aUString, nType, false ) )
+                                    if (!aPropItem.Read(aUString, nType, false))
                                         break;
 
                                     OUString aString( aUString );


More information about the Libreoffice-commits mailing list