[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - writerfilter/source

Vasily Melenchuk (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 5 09:35:56 UTC 2020


 writerfilter/source/rtftok/rtfdocumentimpl.hxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 37d5df2bad464baf7f0c16c15efcf7047c3d370e
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Wed Nov 4 13:37:01 2020 +0300
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Nov 5 10:35:21 2020 +0100

    RTF import: change exception type thrown on destination errors
    
    Previous exception (std::out_of_range) was not catch in case
    of invalid RTF imported: wrapping code checks only for
    uno::exception. This is not a case for loading file, but
    for parsing of clipboard containing invalid RTF it was causing
    fatal error, freeze and/or LO crash due to unhandled exception.
    
    I think there is no reason to add generic processing for
    std::exception in RTF filter: this can complicate diagnosing
    other potential problems. Instead let's throw UNO exception,
    like in other parts of RTF filter code.
    
    Change-Id: I064bbdc1559cc7700c96dbbeaf2911a2c8e0421e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105285
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 0d84e4bed71a1083c5189408aea5922a34b40686)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105227
    Tested-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 360c753172b7..0e7f1fdfbcf8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -16,6 +16,7 @@
 #include <boost/optional.hpp>
 
 #include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/io/WrongFormatException.hpp>
 #include <oox/mathml/importutils.hxx>
 #include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -637,13 +638,15 @@ public:
     RTFParserState& top()
     {
         if (m_Impl.empty())
-            throw std::out_of_range("empty rtf state stack");
+            throw css::io::WrongFormatException(
+                "Parser state is empty! Invalid usage of destination braces in RTF?", nullptr);
         return m_Impl.back();
     }
     void pop()
     {
         if (m_Impl.empty())
-            throw std::out_of_range("empty rtf state stack");
+            throw css::io::WrongFormatException(
+                "Parser state is empty! Invalid usage of destination braces in RTF?", nullptr);
         return m_Impl.pop_back();
     }
     void push(RTFParserState const& rState) { return m_Impl.push_back(rState); }


More information about the Libreoffice-commits mailing list