summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrasin <krasin@google.com>2015-07-29 13:12:45 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-29 20:13:35 +0000
commit3bc9c19c192d2dadf39e2594ed2ac68350f04e18 (patch)
tree0434188bceae68689f8640f303b4a92d5c187235
parent9a1d9069e8ae4d3279d4ddefacbe7b42550440e6 (diff)
downloadchromium_src-3bc9c19c192d2dadf39e2594ed2ac68350f04e18.zip
chromium_src-3bc9c19c192d2dadf39e2594ed2ac68350f04e18.tar.gz
chromium_src-3bc9c19c192d2dadf39e2594ed2ac68350f04e18.tar.bz2
CFI: Fix invalid cast to PrefRegistrySyncable.
This bug was found by Control Flow Integrity check, see https://sites.google.com/a/chromium.org/dev/developers/testing/control-flow-integrity LazyBackgroundTaskQueueTest creates TestingPrefServiceSimple, which initializes prefs registry with PrefRegistrySimple, which then could be incorrectly casted to its subclass PrefRegistrySyncable. The solution is to initialize prefs registry with PrefRegistrySyncable. See more details in http://crbug.com/513953 BUG=chromium:513953, chromium:457523 Review URL: https://codereview.chromium.org/1269523003 Cr-Commit-Position: refs/heads/master@{#340962}
-rw-r--r--extensions/BUILD.gn1
-rw-r--r--extensions/browser/lazy_background_task_queue_unittest.cc3
-rw-r--r--extensions/extensions_tests.gyp1
3 files changed, 4 insertions, 1 deletions
diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn
index c64f5b1..810381b 100644
--- a/extensions/BUILD.gn
+++ b/extensions/BUILD.gn
@@ -159,6 +159,7 @@ test("extensions_unittests") {
"//base:prefs_test_support",
"//base/test:test_support",
"//components/keyed_service/content",
+ "//components/pref_registry:test_support",
"//components/user_prefs",
"//content/test:test_support",
"//device/bluetooth:mocks",
diff --git a/extensions/browser/lazy_background_task_queue_unittest.cc b/extensions/browser/lazy_background_task_queue_unittest.cc
index 917967d1..0dc103b 100644
--- a/extensions/browser/lazy_background_task_queue_unittest.cc
+++ b/extensions/browser/lazy_background_task_queue_unittest.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/prefs/testing_pref_service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "components/pref_registry/testing_pref_service_syncable.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_browser_context.h"
@@ -114,7 +115,7 @@ class LazyBackgroundTaskQueueTest : public ExtensionsTest {
private:
scoped_ptr<content::NotificationService> notification_service_;
- TestingPrefServiceSimple testing_pref_service_;
+ user_prefs::TestingPrefServiceSyncable testing_pref_service_;
// The total number of pending tasks that have been executed.
int task_run_count_;
diff --git a/extensions/extensions_tests.gyp b/extensions/extensions_tests.gyp
index c64180b..9d06668 100644
--- a/extensions/extensions_tests.gyp
+++ b/extensions/extensions_tests.gyp
@@ -18,6 +18,7 @@
'../base/base.gyp:base',
'../base/base.gyp:test_support_base',
'../components/components.gyp:keyed_service_content',
+ '../components/components.gyp:pref_registry_test_support',
'../components/components.gyp:user_prefs',
'../content/content_shell_and_tests.gyp:test_support_content',
'../device/bluetooth/bluetooth.gyp:device_bluetooth_mocks',