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

Issue 2802433004: ExtensionsTest: Move initialization to SetUp and avoid potential UAF. (Closed)

Created:
3 years, 8 months ago by karandeepb
Modified:
3 years, 8 months ago
Reviewers:
Devlin
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

ExtensionsTest: Move initialization to SetUp and avoid potential UAF. ExtensionsTest does all its initialization in its constructor but destroys its initialized instances in TearDown(). This CL moves all the initialization logic to its SetUp() method to make the initialization consistent with destruction. The ExtensionsTest subclasses which rely on the current initialization sequence are also modified. Also, currently the extensions_browser_client_ instance is reset in TearDown() but not unset as the singleton until the destructor. This can cause use after free errors. This is also fixed by resetting the singleton instances in TearDown() itself. BUG=708256 Review-Url: https://codereview.chromium.org/2802433004 Cr-Commit-Position: refs/heads/master@{#463854} Committed: https://chromium.googlesource.com/chromium/src/+/fb19fb99a92bd5335dd24dde693e64f8ced55cbf

Patch Set 1 #

Total comments: 1

Patch Set 2 : Rebase. #

Patch Set 3 : Fix test. #

Patch Set 4 : Rebase. #

Patch Set 5 : Avoid UAF. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -44 lines) Patch
M extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc View 1 2 3 2 chunks +7 lines, -2 lines 0 comments Download
M extensions/browser/api/file_handlers/mime_util_unittest.cc View 1 chunk +1 line, -0 lines 0 comments Download
M extensions/browser/extensions_test.cc View 1 2 3 4 3 chunks +17 lines, -29 lines 1 comment Download
M extensions/browser/lazy_background_task_queue_unittest.cc View 1 chunk +1 line, -0 lines 0 comments Download
M extensions/browser/policy_check_unittest.cc View 1 chunk +4 lines, -4 lines 0 comments Download
M extensions/browser/process_manager_unittest.cc View 3 chunks +12 lines, -5 lines 0 comments Download
M extensions/browser/updater/update_service_unittest.cc View 2 chunks +3 lines, -4 lines 0 comments Download

Messages

Total messages: 31 (24 generated)
karandeepb
PTAL Devlin https://codereview.chromium.org/2802433004/diff/1/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc File extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc (right): https://codereview.chromium.org/2802433004/diff/1/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc#newcode46 extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc:46: mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()) { Seems this is leaked. ...
3 years, 8 months ago (2017-04-06 03:29:24 UTC) #8
karandeepb
On 2017/04/06 03:29:24, karandeepb wrote: > PTAL Devlin > > https://codereview.chromium.org/2802433004/diff/1/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc > File extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc > ...
3 years, 8 months ago (2017-04-06 04:43:50 UTC) #11
Devlin
On 2017/04/06 04:43:50, karandeepb wrote: > Devlin: Please hold off this review. There seems to ...
3 years, 8 months ago (2017-04-06 14:12:20 UTC) #12
karandeepb
PTAL Devlin. https://codereview.chromium.org/2802433004/diff/80001/extensions/browser/extensions_test.cc File extensions/browser/extensions_test.cc (right): https://codereview.chromium.org/2802433004/diff/80001/extensions/browser/extensions_test.cc#newcode38 extensions/browser/extensions_test.cc:38: content::SetBrowserClientForTesting(nullptr); I also tried to move: content::SetBrowserClientForTesting(nullptr); ...
3 years, 8 months ago (2017-04-10 22:26:23 UTC) #25
Devlin
lgtm
3 years, 8 months ago (2017-04-11 22:00:10 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2802433004/80001
3 years, 8 months ago (2017-04-11 22:36:08 UTC) #28
commit-bot: I haz the power
3 years, 8 months ago (2017-04-12 00:24:54 UTC) #31
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/fb19fb99a92bd5335dd24dde693e...

Powered by Google App Engine
This is Rietveld 408576698