Skip to content

Commit 6782baa

Browse files
Mike Wassermanmibrunin
Mike Wasserman
authored andcommitted
[Backport] Security bug 1506535
Manual cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/chromium/src/+/5146875: [M120 merge] Speculative fix for UAF in content::WebContentsImpl::ExitFullscreenMode (cherry picked from commit c1cda70a433a0c625b280eb88ed6ff4f4feffa12) Bug: 1506535, 854815 Change-Id: Iace64d63f8cea2dbfbc761ad233db42451ec101c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5146875 Commit-Queue: John Abd-El-Malek <[email protected]> Auto-Submit: Mike Wasserman <[email protected]> Reviewed-by: John Abd-El-Malek <[email protected]> Cr-Original-Commit-Position: refs/heads/main@{#1240353} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5178801 Cr-Commit-Position: refs/branch-heads/6099@{#1727} Cr-Branched-From: e6ee4500f7d6549a9ac1354f8d056da49ef406be-refs/heads/main@{#1217362} Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/532058 Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent bbb9bf9 commit 6782baa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

chromium/content/browser/web_contents/web_contents_impl.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3504,7 +3504,12 @@ void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) {
35043504
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::ExitFullscreenMode",
35053505
"will_cause_resize", will_cause_resize);
35063506
if (delegate_) {
3507+
// This may spin the message loop and destroy this object crbug.com/1506535
3508+
base::WeakPtr<WebContentsImpl> weak_ptr = weak_factory_.GetWeakPtr();
35073509
delegate_->ExitFullscreenModeForTab(this);
3510+
if (!weak_ptr) {
3511+
return;
3512+
}
35083513

35093514
if (keyboard_lock_widget_)
35103515
delegate_->CancelKeyboardLockRequest(this);

0 commit comments

Comments
 (0)