tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 17dd398e0734031e968ea2ba0e230e9f80ba138e
parent 77772d24a81a3382db5c723aa1876d235f8283cb
Author: Dan Baker <dbaker@mozilla.com>
Date:   Thu, 23 Oct 2025 17:27:58 -0600

Bug 1995393 - Vendor libwebrtc from 7a03b7ab86

Upstream commit: https://webrtc.googlesource.com/src/+/7a03b7ab867462dd935f7a724bc448bbf451c237
    Add error handling for SetBitrate when PeerConnection is closed

    When SetBitrate is called after the PeerConnection has been closed,
    it could lead to RTC_DCHECK (on debug builds) or null pointer dereferenceon release builds. This change adds appropriate error handling and a test case for this scenario.

    Bug: webrtc:439455390
    Change-Id: I1e51fe3c0477877b0239d5b378aa94c3247b8016
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/404980
    Auto-Submit: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Commit-Queue: Harald Alvestrand <hta@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45379}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/pc/peer_connection.cc | 6+++++-
Mthird_party/libwebrtc/pc/peer_connection_interface_unittest.cc | 10++++++++++
3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T23:24:23.591316+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T23:27:46.078643+00:00. # base of lastest vendoring -4e1217b0dd +7a03b7ab86 diff --git a/third_party/libwebrtc/pc/peer_connection.cc b/third_party/libwebrtc/pc/peer_connection.cc @@ -1594,6 +1594,11 @@ RTCError PeerConnection::SetBitrate(const BitrateSettings& bitrate) { } RTC_DCHECK_RUN_ON(worker_thread()); + if (!call_) { + LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_STATE, + "PeerConnection is closed."); + } + const bool has_min = bitrate.min_bitrate_bps.has_value(); const bool has_start = bitrate.start_bitrate_bps.has_value(); const bool has_max = bitrate.max_bitrate_bps.has_value(); @@ -1623,7 +1628,6 @@ RTCError PeerConnection::SetBitrate(const BitrateSettings& bitrate) { } } - RTC_DCHECK(call_.get()); call_->SetClientBitratePreferences(bitrate); return RTCError::OK(); diff --git a/third_party/libwebrtc/pc/peer_connection_interface_unittest.cc b/third_party/libwebrtc/pc/peer_connection_interface_unittest.cc @@ -3557,6 +3557,16 @@ TEST_P(PeerConnectionInterfaceTest, SetBitrateCurrentLessThanImplicitMin) { EXPECT_TRUE(pc_->SetBitrate(bitrate).ok()); } +TEST_P(PeerConnectionInterfaceTest, SetBitrateAfterCloseFails) { + CreatePeerConnection(); + pc_->Close(); + BitrateSettings bitrate; + bitrate.start_bitrate_bps = 1; + auto ret = pc_->SetBitrate(bitrate); + EXPECT_FALSE(ret.ok()); + EXPECT_EQ(RTCErrorType::INVALID_STATE, ret.type()); +} + // The following tests verify that the offer can be created correctly. TEST_P(PeerConnectionInterfaceTest, CreateOfferFailsWithInvalidOfferToReceiveAudio) {