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

Caolán McNamara caolanm at redhat.com
Fri Aug 28 04:32:19 PDT 2015


 sd/qa/unit/data/ppt/pass/hang-4.ppt |binary
 sd/qa/unit/data/ppt/pass/hang-7.ppt |binary
 sd/source/filter/ppt/propread.cxx   |   31 ++++++++++++++++++++-----------
 3 files changed, 20 insertions(+), 11 deletions(-)

New commits:
commit 61542931de7abe69a459f3e59513e330ecf47211
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 27 13:00:36 2015 +0100

    check for stream status after a read, not after a seek
    
    Change-Id: I984e99c1a1484547aa4d60bf301167f3cbc9f716
    (cherry picked from commit eea399ddd52a0de368321963bb828bc15632dd0b)
    Reviewed-on: https://gerrit.libreoffice.org/18088
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sd/qa/unit/data/ppt/pass/hang-4.ppt b/sd/qa/unit/data/ppt/pass/hang-4.ppt
new file mode 100644
index 0000000..f5aa247
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-4.ppt differ
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 036f1f9..d738eb8 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -319,7 +319,7 @@ bool Section::GetDictionary( Dictionary& rDict )
 
 void Section::Read( SotStorageStream *pStrm )
 {
-    sal_uInt32 i, nSecOfs, nPropType, nPropSize, nCurrent, nVectorCount, nTemp, nStrmSize;
+    sal_uInt32 i, nSecOfs, nPropSize, nStrmSize;
     nSecOfs = pStrm->Tell();
 
     pStrm->Seek( STREAM_SEEK_TO_END );
@@ -329,16 +329,20 @@ void Section::Read( SotStorageStream *pStrm )
     mnTextEnc = RTL_TEXTENCODING_MS_1252;
     sal_uInt32 nSecSize(0), nPropCount(0);
     pStrm->ReadUInt32( nSecSize ).ReadUInt32( nPropCount );
-    while (nPropCount-- && pStrm->good())
+    while (nPropCount--)
     {
         sal_uInt32 nPropId(0), nPropOfs(0);
-        pStrm->ReadUInt32( nPropId ).ReadUInt32( nPropOfs );
-        nCurrent = pStrm->Tell();
-        pStrm->Seek( nPropOfs + nSecOfs );
+        pStrm->ReadUInt32(nPropId).ReadUInt32(nPropOfs);
+        if (!pStrm->good())
+            break;
+        auto nCurrent = pStrm->Tell();
+        sal_uInt64 nOffset = nPropOfs + nSecOfs;
+        if (nOffset != pStrm->Seek(nOffset))
+            break;
         if ( nPropId )                  // do not read dictionary
         {
-
-            pStrm->ReadUInt32( nPropType );
+            sal_uInt32 nPropType(0), nVectorCount(0);
+            pStrm->ReadUInt32(nPropType);
 
             nPropSize = 4;
 
@@ -360,6 +364,7 @@ void Section::Read( SotStorageStream *pStrm )
                     pStrm->ReadUInt32( nPropType );
                     nPropSize += 4;
                 }
+                sal_uInt32 nTemp(0);
                 switch( nPropType )
                 {
                     case VT_UI1 :
@@ -457,11 +462,11 @@ void Section::Read( SotStorageStream *pStrm )
                 PropItem aPropItem;
                 if ( GetProperty( 1, aPropItem ) )
                 {
-                    sal_uInt16 nCodePage;
                     aPropItem.ReadUInt32( nPropType );
                     if ( nPropType == VT_I2 )
                     {
-                        aPropItem.ReadUInt16( nCodePage );
+                        sal_uInt16 nCodePage(0);
+                        aPropItem.ReadUInt16(nCodePage);
 
                         if ( nCodePage == 1200 )
                         {
@@ -503,7 +508,7 @@ void Section::Read( SotStorageStream *pStrm )
             AddProperty( 0xffffffff, pBuf, nSize );
             delete[] pBuf;
         }
-        pStrm->Seek( nCurrent );
+        pStrm->Seek(nCurrent);
     }
     pStrm->Seek( nSecOfs + nSecSize );
 }
commit a7fd3a06834900c449448f21624f03edc7b27dda
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 27 13:58:48 2015 +0100

    check seek for success
    
    Change-Id: I02420ffb3af009d08ce54a0932e2c7a287703a72
    (cherry picked from commit 1830b4f2e324090962a993315ce76752d24d4088)
    Reviewed-on: https://gerrit.libreoffice.org/18091
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sd/qa/unit/data/ppt/pass/hang-7.ppt b/sd/qa/unit/data/ppt/pass/hang-7.ppt
new file mode 100644
index 0000000..8c05271
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-7.ppt differ
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 75a4bcc..036f1f9 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -427,7 +427,11 @@ void Section::Read( SotStorageStream *pStrm )
                 if ( nPropSize )
                 {
                     if ( ( nVectorCount - i ) > 1 )
-                        pStrm->Seek( nPropOfs + nSecOfs + nPropSize );
+                    {
+                        nOffset = nPropOfs + nSecOfs + nPropSize;
+                        if (nOffset != pStrm->Seek(nOffset))
+                            break;
+                    }
                 }
                 else
                     break;


More information about the Libreoffice-commits mailing list