DNR: Fix DCHECK failure and Use-After-Free while reindexing.
The class ReindexHelper manages its own lifetime and dispatches tasks to reindex rulesets. However these tasks can return synchronously. This can cause |callback_count_| to become 0 in ReindexHelper::OnReindexCompleted, causing ReindexHelper to be freed. We might still be in the loop which dispatches reindexing tasks in ReindexHelper::Start, leading to a use after free. In debug builds, this should cause a DCHECK in OnReindexCompleted. Fix this by using ref counting for ReindexHelper ownership. Also use a BarrierClosure since it simplifies the code. BUG=1063177 Change-Id: I0a56e33a508e44b7fe465f148c05f048e9b05deb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2111393 Commit-Queue: Karan Bhatia <karandeepb@chromium.org> Auto-Submit: Karan Bhatia <karandeepb@chromium.org> Reviewed-by:Istiaque Ahmed <lazyboy@chromium.org> Cr-Commit-Position: refs/heads/master@{#752653}
Showing
Please register or sign in to comment