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

Issue 2417383002: VideoCaptureManager: fixed double-deletion bug in StopCaptureForClient() on error (Closed)

Created:
4 years, 2 months ago by mcasas
Modified:
4 years, 2 months ago
Reviewers:
xianglu
CC:
chromium-reviews, posciak+watch_chromium.org, jam, feature-media-reviews_chromium.org, darin-cc_chromium.org, mcasas+watch+vc_chromium.org, miu+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

VideoCaptureManager: fixed double-deletion bug in StopCaptureForClient() on error VideoCaptureManager::StopCaptureForClient() [1], when called in error condition, will run, in the beginning, DeviceEntry* entry = GetDeviceEntryByController(controller); but then, if |aborted_due_to_error|, it would also call (l.719 [2]) synchronuosly: listener_->Aborted(...); MediaStreamManager::StopDevice(...) MediaStreamManager::CloseDevice(...); VideoCaptureManager::Close(...); VideoCaptureManager::DestroyDeviceIfNoClient(...); the last one will invalidate |entry| and destroy the |controller| needed in l.727 [3], hence the UAF. This bug was there before the blamed CLs (see bug), but the migration to mojo has made this path more possible for Cluster Fuzz to exercise. Note: I have no clue how ClusterFuzz managed this, I had to patch the code to cause this error condition :) [1] https://cs.chromium.org/chromium/src/content/browser/renderer_host/media/video_capture_manager.cc?q=VideoCaptureManager::StopCaptureForClient&sq=package:chromium&l=689&dr=CSs [2] https://cs.chromium.org/chromium/src/content/browser/renderer_host/media/video_capture_manager.cc?q=VideoCaptureManager::StopCaptureForClient&sq=package:chromium&dr=CSs&l=719 [3] https://cs.chromium.org/chromium/src/content/browser/renderer_host/media/video_capture_manager.cc?q=VideoCaptureManager::StopCaptureForClient&sq=package:chromium&dr=CSs&l=727 BUG=654199 TEST= see bug for repro; doesn't crash with the patch, capture device is still correctly closed. Committed: https://crrev.com/abb68a36070c6f5a183c8db994a3f1f9e250d16f Cr-Commit-Position: refs/heads/master@{#425525}

Patch Set 1 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -10 lines) Patch
M content/browser/renderer_host/media/video_capture_manager.cc View 2 chunks +10 lines, -10 lines 2 comments Download

Messages

Total messages: 13 (6 generated)
mcasas
xianglu@ PTAL
4 years, 2 months ago (2016-10-14 22:04:48 UTC) #4
xianglu
https://codereview.chromium.org/2417383002/diff/20001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/2417383002/diff/20001/content/browser/renderer_host/media/video_capture_manager.cc#newcode717 content/browser/renderer_host/media/video_capture_manager.cc:717: // Aborted() call might synchronously destroy |entry|, recheck. If ...
4 years, 2 months ago (2016-10-14 23:28:22 UTC) #5
mcasas
https://codereview.chromium.org/2417383002/diff/20001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/2417383002/diff/20001/content/browser/renderer_host/media/video_capture_manager.cc#newcode717 content/browser/renderer_host/media/video_capture_manager.cc:717: // Aborted() call might synchronously destroy |entry|, recheck. On ...
4 years, 2 months ago (2016-10-14 23:44:10 UTC) #6
xianglu
lgtm
4 years, 2 months ago (2016-10-14 23:57:53 UTC) #7
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/2417383002/20001
4 years, 2 months ago (2016-10-15 00:10:54 UTC) #9
commit-bot: I haz the power
Committed patchset #1 (id:20001)
4 years, 2 months ago (2016-10-15 01:08:18 UTC) #11
commit-bot: I haz the power
4 years, 2 months ago (2016-10-15 01:10:47 UTC) #13
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/abb68a36070c6f5a183c8db994a3f1f9e250d16f
Cr-Commit-Position: refs/heads/master@{#425525}

Powered by Google App Engine
This is Rietveld 408576698