chore: cherry-pick 22f27676515e from chromium #32743
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WebContentsVideoCaptureDevice: Fix use-after-free
The classes WebContentsVideoCaptureDevice,
AuraWindowVideoCaptureDevice::WindowTracker, and
ViewsWidgetVideoCaptureDeviceMac::UIThreadDelegate all keep a raw
pointer that they use to access the MouseCursorOverlayController.
This raw pointer comes from the base class FrameSinkVideoCaptureDevice
and should outlive the class that has a raw pointer. On macOS, this
isn't necessarily the case.
Avoid this sharp edge by using a WeakPtr for the
MouseCursorOverlayController, and checking that it is valid before
using it.
Bug: 1252562, 1179098
Change-Id: I1d74bea1255597662aab3f9f2430c49d2e39836a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3260842
Commit-Queue: ccameron ccameron@chromium.org
Reviewed-by: mark a. foltz mfoltz@chromium.org
Cr-Commit-Position: refs/heads/main@{#939604}
Notes: Security: backported fix for 1252562, 1179098.