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

Unified Diff: chrome/browser/safe_browsing/preference_validation_delegate.cc

Issue 336983002: Fix NULL deref in safe browsing preference validation delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: parens Created 6 years, 6 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 | « chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/preference_validation_delegate.cc
diff --git a/chrome/browser/safe_browsing/preference_validation_delegate.cc b/chrome/browser/safe_browsing/preference_validation_delegate.cc
index 805bda655b11245820bef4bf5090c7abe7d53307..5d0dfb523ab1760bf36aebd795867c6df8f28afa 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,
gab 2014/06/16 15:45:03 This parameter is also unused, comment it out.
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(
« no previous file with comments | « chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698