summaryrefslogtreecommitdiffstats
path: root/base/prefs
diff options
context:
space:
mode:
authorbattre <battre@chromium.org>2015-01-05 10:50:19 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-05 18:51:11 +0000
commit0a69defef6c4de84db795a6d7ba0067c315250ef (patch)
tree62e5aa608f8f1e222e4bb38ff5624d92a2ad2909 /base/prefs
parentc3b7b04a254577e13d592a2dd5c8ac67e93fdabe (diff)
downloadchromium_src-0a69defef6c4de84db795a6d7ba0067c315250ef.zip
chromium_src-0a69defef6c4de84db795a6d7ba0067c315250ef.tar.gz
chromium_src-0a69defef6c4de84db795a6d7ba0067c315250ef.tar.bz2
Added checks for use after free of PrefService
BUG=435208 Review URL: https://codereview.chromium.org/833163002 Cr-Commit-Position: refs/heads/master@{#309925}
Diffstat (limited to 'base/prefs')
-rw-r--r--base/prefs/pref_service.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc
index 7a3b434..5afb5ea 100644
--- a/base/prefs/pref_service.cc
+++ b/base/prefs/pref_service.cc
@@ -53,6 +53,12 @@ PrefService::PrefService(
read_error_callback_(read_error_callback) {
pref_notifier_->SetPrefService(this);
+ // TODO(battre): This is a check for crbug.com/435208 to make sure that
+ // access violations are caused by a use-after-free bug and not by an
+ // initialization bug.
+ CHECK(pref_registry_);
+ CHECK(pref_value_store_);
+
InitFromStorage(async);
}
@@ -562,6 +568,14 @@ bool PrefService::Preference::IsExtensionModifiable() const {
const base::Value* PrefService::GetPreferenceValue(
const std::string& path) const {
DCHECK(CalledOnValidThread());
+
+ // TODO(battre): This is a check for crbug.com/435208. After analyzing some
+ // crash dumps it looks like the PrefService is accessed even though it has
+ // been cleared already.
+ CHECK(pref_registry_);
+ CHECK(pref_registry_->defaults());
+ CHECK(pref_value_store_);
+
const base::Value* default_value = NULL;
if (pref_registry_->defaults()->GetValue(path, &default_value)) {
const base::Value* found_value = NULL;