Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2808)

Unified Diff: chrome/browser/supervised_user/supervised_user_settings_service.cc

Issue 2201373002: Ignore invalid managed user settings values gracefully. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: response to more code review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/supervised_user/supervised_user_settings_service.cc
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.cc b/chrome/browser/supervised_user/supervised_user_settings_service.cc
index 6628c217b971eae0cc53a31dfcc1dc00efbd5a72..05eb3bf579faee184790d030157f74c4ffc222cb 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service.cc
+++ b/chrome/browser/supervised_user/supervised_user_settings_service.cc
@@ -241,6 +241,14 @@ SyncMergeResult SupervisedUserSettingsService::MergeDataAndStartSyncing(
sync_data.GetSpecifics().managed_user_setting();
std::unique_ptr<base::Value> value =
JSONReader::Read(supervised_user_setting.value());
+ // Wrongly formatted input will cause null values.
+ // SetWithoutPathExpansion below requires non-null values.
+ if (!value) {
+ DLOG(ERROR) << "Invalid managed user setting value: "
+ << supervised_user_setting.value()
+ << ". Values must be JSON values.";
+ continue;
+ }
std::string name_suffix = supervised_user_setting.name();
std::string name_key = name_suffix;
base::DictionaryValue* dict = GetDictionaryAndSplitKey(&name_suffix);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698