svx/source/unodraw/UnoGraphicExporter.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
New commits: commit ed99f19b819dd057cc6f4411639d8b4f9a9d4578 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Aug 20 15:01:02 2024 +0500 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Aug 21 12:28:37 2024 +0200 tdf#162528: handle exceptions from JSON parser in GraphicExporter Similar to commit 218695f947dfecaa92209adf0c5572b99f0c021f "tdf#150846: FilterOptions in descriptor could come from import filter", 2022-09-21 Change-Id: I3123bb2c136d1bc5545d0412eb1db5e5fd9c91b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172105 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 20b16048236598880dc94bac146079426ae8f309) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172133 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 9fa4b52284bb..541af3219a12 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/task/XInteractionContinuation.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <boost/property_tree/json_parser/error.hpp> #include <tools/debug.hxx> #include <comphelper/diagnose_ex.hxx> #include <tools/urlobj.hxx> @@ -388,9 +389,16 @@ void GraphicExporter::ParseSettings(const Sequence<PropertyValue>& rDescriptor, if (!aFilterData.hasElements() && !aFilterOptions.isEmpty()) { // Allow setting filter data keys from the cmdline. - std::vector<PropertyValue> aData - = comphelper::JsonToPropertyValues(aFilterOptions.toUtf8()); - aFilterData = comphelper::containerToSequence(aData); + try + { + std::vector<PropertyValue> aData + = comphelper::JsonToPropertyValues(aFilterOptions.toUtf8()); + aFilterData = comphelper::containerToSequence(aData); + } + catch (const boost::property_tree::json_parser::json_parser_error&) + { + // This wasn't a valid json; maybe came from import filter (tdf#162528) + } if (aFilterData.hasElements()) { aMap[u"FilterData"_ustr] <<= aFilterData;