[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - cui/source

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Mon May 31 07:18:59 UTC 2021


 cui/source/dialogs/AdditionsDialog.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 9a9089d0f7c205ed6428e55fb86062c715483a4b
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Sat May 29 18:17:54 2021 +0300
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon May 31 09:18:26 2021 +0200

    tdf#136292: Fix crash on invalid JSON from the extensions API
    
    Change-Id: I91ed555f93173dee10e87025b231560693be50b5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116390
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
    (cherry picked from commit e98b0891d6e0f1d6be4e4a4761bd1ab16bfab85c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116168
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index 8bd5dee65222..a80e8562c398 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -45,6 +45,7 @@
 #include <com/sun/star/task/XInteractionApprove.hpp>
 
 #include <orcus/json_document_tree.hpp>
+#include <orcus/json_parser.hpp>
 #include <orcus/config.hpp>
 #include <orcus/pstring.hpp>
 
@@ -124,7 +125,15 @@ void parseResponse(const std::string& rResponse, std::vector<AdditionInfo>& aAdd
     if (rResponse.empty())
         return;
 
-    aJsonDoc.load(rResponse, aConfig);
+    try
+    {
+        aJsonDoc.load(rResponse, aConfig);
+    }
+    catch (const orcus::json::parse_error&)
+    {
+        TOOLS_WARN_EXCEPTION("cui.dialogs", "Invalid JSON file from the extensions API");
+        return;
+    }
 
     auto aDocumentRoot = aJsonDoc.get_document_root();
     if (aDocumentRoot.type() != orcus::json::node_t::object)


More information about the Libreoffice-commits mailing list