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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 12 13:40:48 UTC 2021


 vcl/source/gdi/impgraph.cxx |   37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

New commits:
commit b345a2bab0d6f981049951a86b172ce49ce7d4c2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jan 10 19:30:32 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 12 14:40:00 2021 +0100

    cid#1470786 Uncaught exception
    
    Change-Id: I85e75e40c9280b16b12ea268b5070f0ce450208e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109061
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index eba12fd26c44..83e3a196d030 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1117,27 +1117,34 @@ bool ImpGraphic::swapInContent(SvStream& rStream)
     sal_Int32 nType;
     sal_Int32 nLength;
 
-    rStream.ReadUInt32(nId);
-
-    // check version
-    if (SWAP_FORMAT_ID != nId)
+    try
     {
-        SAL_WARN("vcl", "Incompatible swap file!");
-        return false;
-    }
+        rStream.ReadUInt32(nId);
 
-    rStream.ReadInt32(nType);
-    rStream.ReadInt32(nLength);
+        // check version
+        if (SWAP_FORMAT_ID != nId)
+        {
+            SAL_WARN("vcl", "Incompatible swap file!");
+            return false;
+        }
 
-    meType = static_cast<GraphicType>(nType);
+        rStream.ReadInt32(nType);
+        rStream.ReadInt32(nLength);
 
-    if (meType == GraphicType::NONE  || meType == GraphicType::Default)
-    {
-        return true;
+        meType = static_cast<GraphicType>(nType);
+
+        if (meType == GraphicType::NONE  || meType == GraphicType::Default)
+        {
+            return true;
+        }
+        else
+        {
+            bRet = swapInGraphic(rStream);
+        }
     }
-    else
+    catch (const SvStreamEOFException&)
     {
-        bRet = swapInGraphic(rStream);
+        SAL_WARN("vcl", "EOF");
     }
 
     return bRet;


More information about the Libreoffice-commits mailing list