From d80bf1a3839ca9594c745fcbfc6e1681a40a7cbb Mon Sep 17 00:00:00 2001 From: Victor P Date: Mon, 11 Dec 2023 09:16:47 -0800 Subject: [PATCH] [UWP] Fix potential crash in SbSocketSetTcpWindowScaling b/315772525 Change-Id: I883f34429634caadf66ffa002de2ef60778ec2f1 --- starboard/shared/win32/socket_set_tcp_window_scaling.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/starboard/shared/win32/socket_set_tcp_window_scaling.cc b/starboard/shared/win32/socket_set_tcp_window_scaling.cc index 0e7306605a21..091af3cc51e9 100644 --- a/starboard/shared/win32/socket_set_tcp_window_scaling.cc +++ b/starboard/shared/win32/socket_set_tcp_window_scaling.cc @@ -30,6 +30,9 @@ bool SbSocketSetTcpWindowScaling(SbSocket socket, bool enable_window_scaling) { // later, receive window auto-tuning is enabled and the TCP window scale // factor is reduced to 2 from the default value of 8." + if (socket == kSbSocketInvalid) + return false; + const ULONG target_os_version = enable_window_scaling ? NTDDI_VISTA : NTDDI_WS03; WSA_COMPATIBILITY_MODE compatibility_mode = {WsaBehaviorAutoTuning,