[Libreoffice-commits] core.git: sfx2/source sw/qa

Caolán McNamara caolanm at redhat.com
Thu Aug 20 02:36:34 PDT 2015


 sfx2/source/doc/oleprops.cxx        |   17 ++++++++++-------
 sw/qa/core/data/ww8/pass/hang-4.doc |binary
 2 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 170ff56b1b99ec451e9adbc9ae9c2a94dd47a692
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 19 20:46:16 2015 +0100

    it's no use to check for stream status after a seek
    
    seek resets failures, need to check after a read
    and before a seek
    
    Change-Id: Ia249e258c51af5efc838f92c4ead6237b403c701

diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index 055355b..6552c9e 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -1226,19 +1226,22 @@ void SfxOlePropertySet::ImplLoad( SvStream& rStrm )
 
     // read sections
     sal_Size nSectPosPos = rStrm.Tell();
-    for( sal_Int32 nSectIdx = 0; (nSectIdx < nSectCount) && (rStrm.GetErrorCode() == SVSTREAM_OK) && !rStrm.IsEof(); ++nSectIdx )
+    for (sal_Int32 nSectIdx = 0; nSectIdx < nSectCount; ++nSectIdx)
     {
         // read section guid/position pair
-        rStrm.Seek( nSectPosPos );
+        rStrm.Seek(nSectPosPos);
         SvGlobalName aSectGuid;
-        sal_uInt32 nSectPos;
         rStrm >> aSectGuid;
-        rStrm.ReadUInt32( nSectPos );
+        sal_uInt32 nSectPos(0);
+        rStrm.ReadUInt32(nSectPos);
+        if (!rStrm.good())
+            break;
         nSectPosPos = rStrm.Tell();
         // read section
-        rStrm.Seek( static_cast< sal_Size >( nSectPos ) );
-        if( rStrm.GetErrorCode() == SVSTREAM_OK )
-            LoadObject( rStrm, AddSection( aSectGuid ) );
+        rStrm.Seek(nSectPos);
+        LoadObject(rStrm, AddSection(aSectGuid));
+        if (!rStrm.good())
+            break;
     }
 }
 
diff --git a/sw/qa/core/data/ww8/pass/hang-4.doc b/sw/qa/core/data/ww8/pass/hang-4.doc
new file mode 100644
index 0000000..b7fd040
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/hang-4.doc differ


More information about the Libreoffice-commits mailing list