summaryrefslogtreecommitdiff
path: root/filter/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-12-28 20:07:26 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-12-29 12:06:29 +0100
commit646a635efe6eecbc3d1dd3a7cbb02a278c6f3be5 (patch)
treebe02b1fe0cb325852d62a223133c3593bbf686b9 /filter/source
parent0027d94e4f2f41fd492dab6970d7d10a0e1e17cf (diff)
ofz#28931 Indirect-leak
Change-Id: I9ed9d7680cc036c5e6e00a2603bb100628210685 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108424 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter/source')
-rw-r--r--filter/source/msfilter/svdfppt.cxx88
1 files changed, 48 insertions, 40 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index d89f4c3031f5..545afd68514d 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -4768,58 +4768,66 @@ bool PPTTextSpecInfoAtomInterpreter::Read( SvStream& rIn, const DffRecordHeader&
rRecHd.SeekToContent( rIn );
auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, rRecHd.GetRecEndFilePos());
- while (rIn.Tell() < nEndRecPos && rIn.good())
+ try
{
- if ( nRecordType == PPT_PST_TextSpecInfoAtom )
+ while (rIn.Tell() < nEndRecPos && rIn.good())
{
- sal_uInt32 nCharCount(0);
- rIn.ReadUInt32( nCharCount );
- nCharIdx += nCharCount;
- }
+ if ( nRecordType == PPT_PST_TextSpecInfoAtom )
+ {
+ sal_uInt32 nCharCount(0);
+ rIn.ReadUInt32( nCharCount );
+ nCharIdx += nCharCount;
+ }
- sal_uInt32 nFlags(0);
- rIn.ReadUInt32(nFlags);
+ sal_uInt32 nFlags(0);
+ rIn.ReadUInt32(nFlags);
- PPTTextSpecInfo aEntry( nCharIdx );
- if ( pTextSpecDefault )
- {
- aEntry.nDontKnow = pTextSpecDefault->nDontKnow;
- aEntry.nLanguage[ 0 ] = pTextSpecDefault->nLanguage[ 0 ];
- aEntry.nLanguage[ 1 ] = pTextSpecDefault->nLanguage[ 1 ];
- aEntry.nLanguage[ 2 ] = pTextSpecDefault->nLanguage[ 2 ];
- }
- for (sal_uInt32 i = 1; nFlags && i ; i <<= 1)
- {
- sal_uInt16 nLang = 0;
- switch( nFlags & i )
+ PPTTextSpecInfo aEntry( nCharIdx );
+ if ( pTextSpecDefault )
{
- case 0 : break;
- case 1 : rIn.ReadUInt16( aEntry.nDontKnow ); break;
- case 2 : rIn.ReadUInt16( nLang ); break;
- case 4 : rIn.ReadUInt16( nLang ); break;
- default :
- {
- rIn.SeekRel( 2 );
- }
+ aEntry.nDontKnow = pTextSpecDefault->nDontKnow;
+ aEntry.nLanguage[ 0 ] = pTextSpecDefault->nLanguage[ 0 ];
+ aEntry.nLanguage[ 1 ] = pTextSpecDefault->nLanguage[ 1 ];
+ aEntry.nLanguage[ 2 ] = pTextSpecDefault->nLanguage[ 2 ];
}
- if ( nLang )
+ for (sal_uInt32 i = 1; nFlags && i ; i <<= 1)
{
- // #i119985#, we could probably handle this better if we have a
- // place to override the final language for weak
- // characters/fields to fallback to, rather than the current
- // application locale. Assuming that we can determine what the
- // default fallback language for a given .ppt, etc is during
- // load time.
- if (i == 2)
+ sal_uInt16 nLang = 0;
+ switch( nFlags & i )
{
- aEntry.nLanguage[ 0 ] = aEntry.nLanguage[ 1 ] = aEntry.nLanguage[ 2 ] = LanguageType(nLang);
+ case 0 : break;
+ case 1 : rIn.ReadUInt16( aEntry.nDontKnow ); break;
+ case 2 : rIn.ReadUInt16( nLang ); break;
+ case 4 : rIn.ReadUInt16( nLang ); break;
+ default :
+ {
+ rIn.SeekRel( 2 );
+ }
}
+ if ( nLang )
+ {
+ // #i119985#, we could probably handle this better if we have a
+ // place to override the final language for weak
+ // characters/fields to fallback to, rather than the current
+ // application locale. Assuming that we can determine what the
+ // default fallback language for a given .ppt, etc is during
+ // load time.
+ if (i == 2)
+ {
+ aEntry.nLanguage[ 0 ] = aEntry.nLanguage[ 1 ] = aEntry.nLanguage[ 2 ] = LanguageType(nLang);
+ }
+ }
+ nFlags &= ~i;
}
- nFlags &= ~i;
+ aList.push_back( aEntry );
}
- aList.push_back( aEntry );
+ bValid = rIn.Tell() == rRecHd.GetRecEndFilePos();
+ }
+ catch (const SvStreamEOFException&)
+ {
+ SAL_WARN("filter.ms", "EOF");
+ bValid = false;
}
- bValid = rIn.Tell() == rRecHd.GetRecEndFilePos();
return bValid;
}