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

Issue 2624133004: Fix use-after-free in base::Timer::StopAndAbandon() (Closed)

Created:
3 years, 11 months ago by pkotwicz
Modified:
3 years, 11 months ago
Reviewers:
dominickn, gab
CC:
chromium-reviews, chirantan+watch_chromium.org, vmpstr+watch_chromium.org, Xi Han
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix use-after-free in base::Timer::StopAndAbandon() A timer may be owned by a ref counted class. If |Timer::user_task_| is a method in the ref counted class, it is possible for |Timer::user_task_| to hold the only reference to the ref counted class. This CL changes Timer::StopAndAbandon() so that Timer::Stop() is called after Timer::AbandonScheduledTask(). If |Timer::user_task_| holds the only reference to ref counted class, Timer::Stop() destroys the timer object. Timer::StopAndAbandon() can be called while |Timer::user_task_| holds the only reference to the ref counted class if the message loop is shut down. BUG=678592 TEST=MessageLoopShutdownSelfOwningTimer Review-Url: https://codereview.chromium.org/2624133004 Cr-Commit-Position: refs/heads/master@{#444132} Committed: https://chromium.googlesource.com/chromium/src/+/4a286ed6b9406edfb1031ae1d48766f79652a6ca

Patch Set 1 : Merge branch 'master' into timer_bug #

Total comments: 7

Patch Set 2 : Merge branch 'master' into timer_bug #

Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -1 line) Patch
M base/timer/timer.h View 1 1 chunk +3 lines, -1 line 0 comments Download
M base/timer/timer_unittest.cc View 1 2 chunks +45 lines, -0 lines 0 comments Download

Messages

Total messages: 18 (10 generated)
pkotwicz
Dominick can you please take a look? This CL should fix use-after-free in AddToHomescreenDataFetcherTestCommon.ManifestNoNameNoShortName Dominick ...
3 years, 11 months ago (2017-01-12 02:18:28 UTC) #7
dominickn
Nice catch - that is a gnarly case you've found. No obvious problems to me, ...
3 years, 11 months ago (2017-01-12 03:27:17 UTC) #8
pkotwicz
gab@ for base/ OWNERS
3 years, 11 months ago (2017-01-12 05:19:36 UTC) #10
gab
lg, thanks! https://codereview.chromium.org/2624133004/diff/60001/base/timer/timer.h File base/timer/timer.h (right): https://codereview.chromium.org/2624133004/diff/60001/base/timer/timer.h#newcode165 base/timer/timer.h:165: void StopAndAbandon() { On 2017/01/12 03:27:17, dominickn ...
3 years, 11 months ago (2017-01-12 19:42:54 UTC) #11
pkotwicz
gab@ can you please take another look? I think that I have addressed all of ...
3 years, 11 months ago (2017-01-16 19:45:52 UTC) #12
gab
lgtm, thanks!
3 years, 11 months ago (2017-01-17 19:09:45 UTC) #13
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/2624133004/80001
3 years, 11 months ago (2017-01-17 19:10:10 UTC) #15
commit-bot: I haz the power
3 years, 11 months ago (2017-01-17 20:46:04 UTC) #18
Message was sent while issue was closed.
Committed patchset #2 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/4a286ed6b9406edfb1031ae1d487...

Powered by Google App Engine
This is Rietveld 408576698