check stream status

Change-Id: I609c8c4f4e843601361b61f55e0325ad99db3c23
This commit is contained in:
Caolán McNamara
2015-08-28 16:14:07 +01:00
parent 078235028a
commit dc1be62d75
2 changed files with 25 additions and 9 deletions

Binary file not shown.

View File

@@ -280,7 +280,6 @@ bool ImplSdPPTImport::Import()
if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) ) if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) )
{ {
sal_uInt32 nSlideTitleIndex = 0, nSlideTitleCount = 0; sal_uInt32 nSlideTitleIndex = 0, nSlideTitleCount = 0;
sal_uInt32 i, nTemp;
OUString aUString; OUString aUString;
@@ -291,13 +290,14 @@ bool ImplSdPPTImport::Import()
{ {
nVecCount >>= 1; nVecCount >>= 1;
sal_uInt32 nEntryCount = 0; 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 ) ) if ( !aPropItem.Read( aUString, VT_EMPTY, false ) )
break; break;
aPropItem.ReadUInt32( nType ); aPropItem.ReadUInt32( nType );
if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) ) if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) )
break; break;
sal_uInt32 nTemp(0);
aPropItem.ReadUInt32( nTemp ); aPropItem.ReadUInt32( nTemp );
if ( aUString == "Slide Titles" || aUString == "Folientitel" ) if ( aUString == "Slide Titles" || aUString == "Folientitel" )
{ {
@@ -312,17 +312,33 @@ bool ImplSdPPTImport::Import()
aPropItem.ReadUInt32( nType ) aPropItem.ReadUInt32( nType )
.ReadUInt32( nVecCount ); .ReadUInt32( nVecCount );
if ( ( nVecCount >= ( nSlideTitleIndex + nSlideTitleCount ) ) bool bVecOk = ( ( nVecCount >= (nSlideTitleIndex + nSlideTitleCount) )
&& ( nType == ( VT_LPSTR | VT_VECTOR ) ) ) && ( nType == ( VT_LPSTR | VT_VECTOR ) ) );
if (bVecOk)
{ {
for ( i = 0; i != nSlideTitleIndex; i++ ) for (sal_uInt32 i = 0; i != nSlideTitleIndex; ++i)
{ {
aPropItem.ReadUInt32( nTemp ); sal_uInt32 nTemp(0);
aPropItem.SeekRel( nTemp ); 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; break;
OUString aString( aUString ); OUString aString( aUString );