summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramineer@chromium.org <amineer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-15 03:46:35 +0000
committeramineer@chromium.org <amineer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-15 03:46:35 +0000
commit3dfce81ed5dbba8cf3602784f269d23f601946bf (patch)
treef5b603ed41dd2f3cb38a77b40f58380b11a07b15
parentf61794bc3765c0cca04fc2f380433a82e176492f (diff)
downloadchromium_src-3dfce81ed5dbba8cf3602784f269d23f601946bf.zip
chromium_src-3dfce81ed5dbba8cf3602784f269d23f601946bf.tar.gz
chromium_src-3dfce81ed5dbba8cf3602784f269d23f601946bf.tar.bz2
Merge 277282 "Fix NULL deref in safe browsing preference validat..."
> Fix NULL deref in safe browsing preference validation delegate. > > BUG=384729 > TBR=mattm@chromium.org,gab@chromium.org > NOTRY=true > > Review URL: https://codereview.chromium.org/336983002 TBR=grt@chromium.org Review URL: https://codereview.chromium.org/335043002 git-svn-id: svn://svn.chromium.org/chrome/branches/2051/src@277294 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h11
-rw-r--r--chrome/browser/safe_browsing/preference_validation_delegate.cc9
2 files changed, 11 insertions, 9 deletions
diff --git a/chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h b/chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h
index d421bb5..a2e91ac 100644
--- a/chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h
+++ b/chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h
@@ -23,8 +23,9 @@ class TrackedPreferenceValidationDelegate {
virtual ~TrackedPreferenceValidationDelegate() {}
// Notifies observes of the result (|value_state|) of checking the atomic
- // |value| at |pref_path|. |reset_action| indicates whether or not a reset
- // will occur based on |value_state| and the enforcement level in place.
+ // |value| (which may be NULL) at |pref_path|. |reset_action| indicates
+ // whether or not a reset will occur based on |value_state| and the
+ // enforcement level in place.
virtual void OnAtomicPreferenceValidation(
const std::string& pref_path,
const base::Value* value,
@@ -32,9 +33,9 @@ class TrackedPreferenceValidationDelegate {
TrackedPreferenceHelper::ResetAction reset_action) = 0;
// Notifies observes of the result (|value_state|) of checking the split
- // |dict_value| at |pref_path|. |reset_action| indicates whether or not a
- // reset of |value_keys| will occur based on |value_state| and the enforcement
- // level in place.
+ // |dict_value| (which may be NULL) at |pref_path|. |reset_action| indicates
+ // whether or not a reset of |value_keys| will occur based on |value_state|
+ // and the enforcement level in place.
virtual void OnSplitPreferenceValidation(
const std::string& pref_path,
const base::DictionaryValue* dict_value,
diff --git a/chrome/browser/safe_browsing/preference_validation_delegate.cc b/chrome/browser/safe_browsing/preference_validation_delegate.cc
index 805bda6..5d0dfb5 100644
--- a/chrome/browser/safe_browsing/preference_validation_delegate.cc
+++ b/chrome/browser/safe_browsing/preference_validation_delegate.cc
@@ -53,15 +53,16 @@ void PreferenceValidationDelegate::OnAtomicPreferenceValidation(
const std::string& pref_path,
const base::Value* value,
PrefHashStoreTransaction::ValueState value_state,
- TrackedPreferenceHelper::ResetAction reset_action) {
+ TrackedPreferenceHelper::ResetAction /* reset_action */) {
TPIncident_ValueState proto_value_state = MapValueState(value_state);
if (proto_value_state != TPIncident::UNKNOWN) {
scoped_ptr<ClientIncidentReport_IncidentData> incident_data(
new ClientIncidentReport_IncidentData());
TPIncident* incident = incident_data->mutable_tracked_preference();
incident->set_path(pref_path);
- if (!value->GetAsString(incident->mutable_atomic_value()) &&
- !base::JSONWriter::Write(value, incident->mutable_atomic_value())) {
+ if (!value ||
+ (!value->GetAsString(incident->mutable_atomic_value()) &&
+ !base::JSONWriter::Write(value, incident->mutable_atomic_value()))) {
incident->clear_atomic_value();
}
incident->set_value_state(proto_value_state);
@@ -74,7 +75,7 @@ void PreferenceValidationDelegate::OnSplitPreferenceValidation(
const base::DictionaryValue* dict_value,
const std::vector<std::string>& invalid_keys,
PrefHashStoreTransaction::ValueState value_state,
- TrackedPreferenceHelper::ResetAction reset_action) {
+ TrackedPreferenceHelper::ResetAction /* reset_action */) {
TPIncident_ValueState proto_value_state = MapValueState(value_state);
if (proto_value_state != TPIncident::UNKNOWN) {
scoped_ptr<ClientIncidentReport_IncidentData> incident_data(