Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4a2069dce8984504a6eb97526a135c90166f2467
      
https://github.com/WebKit/WebKit/commit/4a2069dce8984504a6eb97526a135c90166f2467
  Author: Kristian Monsen <[email protected]>
  Date:   2026-09-04 (Fri, 04 Sep 2026)

  Changed paths:
    A LayoutTests/ipc/webrtc-create-socket-long-hostname-crash-expected.txt
    A LayoutTests/ipc/webrtc-create-socket-long-hostname-crash.html
    M Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp
    M Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm

  Log Message:
  -----------
  Reject WebRTC socket creation with overlong hostname to fix crash
https://bugs.webkit.org/show_bug.cgi?id=323282
rdar://186254356

Reviewed by Youenn Fablet.

NetworkRTCProvider::createUDPSocket on Cocoa would crash when passed a socket 
address with a
hostname longer than 1023 characters. nw_endpoint_create_host_with_numeric_port 
cannot represent
such a hostname and returns null, so nw_endpoint_get_hostname returns null, and 
constructing a
webrtc::SocketAddress from it traps in the std::string_view constructor's 
libc++ hardening check.

The fix rejects addresses whose hostname cannot be a valid DNS name, alongside 
the existing empty
address check, and notifies the caller with signalSocketIsClosed instead of 
crashing.

Test: ipc/webrtc-create-socket-long-hostname-crash.html

* LayoutTests/ipc/webrtc-create-socket-long-hostname-crash-expected.txt: Added.
* LayoutTests/ipc/webrtc-create-socket-long-hostname-crash.html: Added.
* Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::isInvalidRTCAddress):
(WebKit::NetworkRTCProvider::sendToSocket):
(WebKit::NetworkRTCProvider::createUDPSocket):
(WebKit::NetworkRTCProvider::createClientTCPSocket):
(WebKit::isEmptyRTCAddress): Deleted.
* Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):

Canonical link: https://commits.webkit.org/320520@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to