Skip to content

Commit b52696b

Browse files
riceamibrunin
authored andcommitted
[Backport] CVE-2021-21157: Use after free in Web Sockets
Cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/chromium/src/+/2655089: WebSocket: Don't clear event queue on destruction It's unnecessary to clear the event queue as it will be garbage collected anyway. Stop doing it. Also add a unit test for GC with pending events. This can only happen if the execution context changes while the events are pending. BUG=1170657 Change-Id: I01e5a687587f7471e88640c43f0dfe83e5c01bd1 Reviewed-by: Yutaka Hirano <[email protected]> Commit-Queue: Adam Rice <[email protected]> Cr-Commit-Position: refs/heads/master@{#848065} Reviewed-by: Michal Klocek <[email protected]>
1 parent ba310ee commit b52696b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chromium/third_party/blink/renderer/modules/websockets/dom_websocket.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ DOMWebSocket::EventQueue::EventQueue(EventTarget* target)
7575
this,
7676
&EventQueue::ResumeTimerFired) {}
7777

78-
DOMWebSocket::EventQueue::~EventQueue() {
79-
ContextDestroyed();
78+
DOMWebSocket::EventQueue::~EventQueue() {
79+
resume_timer_.Stop();
8080
}
8181

8282
void DOMWebSocket::EventQueue::Dispatch(Event* event) {

0 commit comments

Comments
 (0)