diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-03-09 14:32:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-03-09 14:38:36 +0000 |
commit | bad797db7fd26e5af97fe1c5b1f3a37fa94a10b2 (patch) | |
tree | d88e1fe4e798a99eac76c3f93f0697f27a4ddba4 /vcl/source/gdi | |
parent | 9e9c7d8b541448fd6022837633d50baa5bbfab69 (diff) |
ofz: stop early on stream failure
Change-Id: I3080dc23605b10bd0e5f7ca28b74f15048ccaccd
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/svmconverter.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index 61fd049b776e..6b6bc6508e42 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, |