Fix crash when reading malformed Flash manifest file (fixes issue #2948)

This commit is contained in:
Cristian Amarie 2020-06-30 18:44:14 +00:00 committed by Marshall Greenblatt
parent 5c1118230d
commit 7b518511df
1 changed files with 6 additions and 4 deletions

View File

@ -158,10 +158,12 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
std::string manifest_data;
if (!base::ReadFileToString(manifest_path, &manifest_data))
return false;
std::unique_ptr<base::Value> 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<base::Value> manifest_value(
base::Value::ToUniquePtrValue(std::move(json_manifest_value.value())));
if (!manifest_value.get())
return false;
base::DictionaryValue* manifest = nullptr;