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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 29 11:07:22 UTC 2020


 filter/source/msfilter/svdfppt.cxx |   88 ++++++++++++++++++++-----------------
 1 file changed, 48 insertions(+), 40 deletions(-)

New commits:
commit 646a635efe6eecbc3d1dd3a7cbb02a278c6f3be5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Dec 28 20:07:26 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 29 12:06:29 2020 +0100

    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 at redhat.com>

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;
 }
 


More information about the Libreoffice-commits mailing list