From 2fef70b6640add3a66a38e66a270f0caa27f2132 Mon Sep 17 00:00:00 2001 From: Cristian Amarie Date: Tue, 30 Jun 2020 18:44:14 +0000 Subject: [PATCH] Fix crash when reading malformed Flash manifest file (fixes issue #2948) --- libcef/common/content_client.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index 6063064f9..99e8535a7 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -162,10 +162,12 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { std::string manifest_data; if (!base::ReadFileToString(manifest_path, &manifest_data)) return false; - std::unique_ptr manifest_value(base::Value::ToUniquePtrValue( - std::move(base::JSONReader::Read(manifest_data, - base::JSON_ALLOW_TRAILING_COMMAS) - .value()))); + auto json_manifest_value = + base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS); + if (!json_manifest_value.has_value()) + return false; + std::unique_ptr manifest_value( + base::Value::ToUniquePtrValue(std::move(json_manifest_value.value()))); if (!manifest_value.get()) return false; base::DictionaryValue* manifest = nullptr;