Skip to content

Commit

Permalink
Cherry-pick 265870.234@safari-7616-branch (9052a03). https://bugs.web…
Browse files Browse the repository at this point in the history
…kit.org/show_bug.cgi?id=259836

    heap-use-after-free in WebKit::AudioSessionRoutingArbitratorProxy::logger
    https://bugs.webkit.org/show_bug.cgi?id=259836
    rdar://112774591

    Reviewed by Simon Fraser.

    Move the ALWAYS_LOG() inside the `if (weakThis)` scope since this macro will
    call `this->logger()`.

    * Source/WebKit/UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
    (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):

    Canonical link: https://commits.webkit.org/265870.234@safari-7616-branch
  • Loading branch information
cdumez authored and aperezdc committed Oct 19, 2023
1 parent 2725c3d commit ed51f64
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@
m_arbitrationStatus = ArbitrationStatus::Pending;
m_arbitrationUpdateTime = WallTime::now();
SharedRoutingArbitrator::sharedInstance().beginRoutingArbitrationForToken(m_token, category, [this, weakThis = WeakPtr { *this }, callback = WTFMove(callback), identifier = WTFMove(identifier)] (RoutingArbitrationError error, DefaultRouteChanged routeChanged) mutable {
ALWAYS_LOG(identifier, "callback, error = ", error, ", routeChanged = ", routeChanged);
if (weakThis)
if (weakThis) {
ALWAYS_LOG(identifier, "callback, error = ", error, ", routeChanged = ", routeChanged);
weakThis->m_arbitrationStatus = error == RoutingArbitrationError::None ? ArbitrationStatus::Active : ArbitrationStatus::None;
}
callback(error, routeChanged);
});
}
Expand Down

0 comments on commit ed51f64

Please sign in to comment.