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

Caolán McNamara caolanm at redhat.com
Thu Mar 9 14:39:19 UTC 2017


 vcl/source/gdi/svmconverter.cxx |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit bad797db7fd26e5af97fe1c5b1f3a37fa94a10b2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 9 14:32:52 2017 +0000

    ofz: stop early on stream failure
    
    Change-Id: I3080dc23605b10bd0e5f7ca28b74f15048ccaccd

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 61fd049..6b6bc65 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -327,14 +327,15 @@ void ImplReadUnicodeComment( sal_uInt32 nStrmPos, SvStream& rIStm, OUString& rSt
     rIStm.Seek( nOld );
 }
 
-void ImplSkipActions( SvStream& rIStm, sal_uLong nSkipCount )
+void ImplSkipActions(SvStream& rIStm, sal_uLong nSkipCount)
 {
     sal_Int32 nActionSize;
     sal_Int16 nType;
-
-    for( sal_uLong i = 0UL; i < nSkipCount; i++ )
+    for (sal_uLong i = 0UL; i < nSkipCount; ++i)
     {
         rIStm.ReadInt16( nType ).ReadInt32( nActionSize );
+        if (!rIStm.good())
+            break;
         rIStm.SeekRel( nActionSize - 4 );
     }
 }
@@ -1350,14 +1351,14 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
             case GDI_TEXTLINE_COMMENT:
             {
                 Point   aStartPt;
-                sal_Int32  nWidth;
-                sal_uInt32 nStrikeout;
-                sal_uInt32 nUnderline;
-                sal_Int32   nFollowingActionCount;
+                sal_Int32  nWidth(0);
+                sal_uInt32 nStrikeout(0);
+                sal_uInt32 nUnderline(0);
+                sal_Int32  nFollowingActionCount(0);
 
                 ReadPair( rIStm, aStartPt );
-                rIStm.ReadInt32( nWidth ).ReadUInt32( nStrikeout ).ReadUInt32( nUnderline ).ReadInt32( nFollowingActionCount );
-                ImplSkipActions( rIStm, nFollowingActionCount );
+                rIStm.ReadInt32(nWidth ).ReadUInt32(nStrikeout).ReadUInt32(nUnderline).ReadInt32(nFollowingActionCount);
+                ImplSkipActions(rIStm, nFollowingActionCount);
                 rMtf.AddAction( new MetaTextLineAction( aStartPt, nWidth,
                                                         (FontStrikeout) nStrikeout,
                                                         (FontLineStyle) nUnderline,


More information about the Libreoffice-commits mailing list