tdf#161858 prevent crashing by catching any JSON exceptions
Change-Id: I733ac428c96a96be668d6334db8c71efaf51beff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170818 Reviewed-by: Patrick Luby <guibomacdev@gmail.com> Tested-by: Jenkins
This commit is contained in:
parent
b5c24d544f
commit
d81ffa179d
1 changed files with 10 additions and 1 deletions
|
@ -217,7 +217,16 @@ uno::Sequence<SingleProofreadingError> parseJson(std::string&& json, std::string
|
|||
{
|
||||
std::stringstream aStream(std::move(json)); // Optimized in C++20
|
||||
boost::property_tree::ptree aRoot;
|
||||
boost::property_tree::read_json(aStream, aRoot);
|
||||
|
||||
// tdf#161858 prevent crashing by catching any JSON exceptions
|
||||
try
|
||||
{
|
||||
boost::property_tree::read_json(aStream, aRoot);
|
||||
}
|
||||
catch (std::runtime_error&)
|
||||
{
|
||||
SAL_WARN("languagetool", "parseJson: read_json() threw exception");
|
||||
}
|
||||
|
||||
if (auto tree = aRoot.get_child_optional(path))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue