From e08b84fbfe6ad0431605b31c2ba5a50a8f116dc9 Mon Sep 17 00:00:00 2001 From: Pirulax Date: Fri, 5 Jan 2024 21:39:16 +0100 Subject: [PATCH 1/6] Fix `SetStreamingBufferSize`possibly accessing memory out-of-bounds (#3284) --- Client/game_sa/CStreamingSA.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Client/game_sa/CStreamingSA.cpp b/Client/game_sa/CStreamingSA.cpp index 0b48b61560..b67c6ee937 100644 --- a/Client/game_sa/CStreamingSA.cpp +++ b/Client/game_sa/CStreamingSA.cpp @@ -431,6 +431,8 @@ void CStreamingSA::RemoveArchive(unsigned char ucArchiveID) bool CStreamingSA::SetStreamingBufferSize(uint32 numBlocks) { + numBlocks += numBlocks % 2; // Make sure number is even by "rounding" it upwards. [Otherwise it can't be split in half properly] + // Check if the size is the same already if (numBlocks == ms_streamingHalfOfBufferSizeBlocks * 2) return true; @@ -453,10 +455,6 @@ bool CStreamingSA::SetStreamingBufferSize(uint32 numBlocks) // Suspend streaming thread [otherwise data might become corrupted] SuspendThread(*phStreamingThread); - - // Create new buffer - if (numBlocks & 1) // Make it be even [Otherwise it can't be split in half properly] - numBlocks++; // Calculate new buffer pointers void* const pNewBuff0 = pNewBuffer; From 22d844d5559ff132c507703818156ed7b8206bdb Mon Sep 17 00:00:00 2001 From: Dutchman101 <12105539+Dutchman101@users.noreply.github.com> Date: Sun, 7 Jan 2024 00:25:11 +0000 Subject: [PATCH 2/6] Update CEF to 120.2.3+g7d89c0c+chromium-120.0.6099.199 --- utils/buildactions/install_cef.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/buildactions/install_cef.lua b/utils/buildactions/install_cef.lua index 2b556b1317..427a1ec583 100644 --- a/utils/buildactions/install_cef.lua +++ b/utils/buildactions/install_cef.lua @@ -9,8 +9,8 @@ local CEF_URL_PREFIX = "https://cef-builds.spotifycdn.com/cef_binary_" local CEF_URL_SUFFIX = "_windows32_minimal.tar.bz2" -- Change here to update CEF version -local CEF_VERSION = "120.1.10+g3ce3184+chromium-120.0.6099.129" -local CEF_HASH = "95d549faf674983b189293212b09bb6137735483d17abcf9da0d1132864fa3be" +local CEF_VERSION = "120.2.3+g7d89c0c+chromium-120.0.6099.199" +local CEF_HASH = "1a64881991a04f5720067f9fff6f47970f960868acd64c9fc41152a641fd9b6f" function make_cef_download_url() return CEF_URL_PREFIX..http.escapeUrlParam(CEF_VERSION)..CEF_URL_SUFFIX From 7201ac5ae71ae181b6e3dfd46845a13cd89d8a7a Mon Sep 17 00:00:00 2001 From: Kamil Schneider Date: Sun, 7 Jan 2024 01:40:23 +0100 Subject: [PATCH 3/6] Trigger onClientPlayerWeaponSwitch for Remote Players (#3238) --- .../mods/deathmatch/logic/rpc/CPlayerRPCs.cpp | 17 +++++++++++++++ .../mods/deathmatch/logic/rpc/CPlayerRPCs.h | 1 + .../mods/deathmatch/logic/CRPCFunctions.cpp | 21 +++++++++++++++++++ Shared/sdk/net/rpc_enums.h | 1 + 4 files changed, 40 insertions(+) diff --git a/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp b/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp index 6756bace22..b438b02bf0 100644 --- a/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp +++ b/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp @@ -23,6 +23,7 @@ void CPlayerRPCs::LoadFunctions() AddHandler(SET_PLAYER_NAMETAG_SHOWING, SetPlayerNametagShowing, "SetPlayerNametagShowing"); AddHandler(SET_PLAYER_TEAM, SetPlayerTeam, "SetPlayerTeam"); AddHandler(TAKE_PLAYER_SCREEN_SHOT, TakePlayerScreenShot, "TakePlayerScreenShot"); + AddHandler(REMOTE_PLAYER_WEAPON_SWITCH, RemotePlayerSwitchWeapon, "RemotePlayerSwitchWeapon"); } void CPlayerRPCs::SetPlayerMoney(NetBitStreamInterface& bitStream) @@ -168,3 +169,19 @@ void CPlayerRPCs::TakePlayerScreenShot(NetBitStreamInterface& bitStream) m_pClientGame->TakePlayerScreenShot(usSizeX, usSizeY, strTag, ucQuality, uiMaxBandwidth, usMaxPacketSize, pResource, uiServerSentTime); } + +void CPlayerRPCs::RemotePlayerSwitchWeapon(CClientEntity* pSource, NetBitStreamInterface& bitStream) +{ + uint lastSlot, currentSlot; + if (bitStream.Read(lastSlot) && bitStream.Read(currentSlot)) + { + CClientPlayer* pPlayer = m_pPlayerManager->Get(pSource->GetID()); + if (IS_REMOTE_PLAYER(pPlayer)) + { + CLuaArguments Arguments; + Arguments.PushNumber(lastSlot); + Arguments.PushNumber(currentSlot); + pPlayer->CallEvent("onClientPlayerWeaponSwitch", Arguments, true); + } + } +} diff --git a/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h b/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h index ec60fd2c35..9a193f2ddb 100644 --- a/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h +++ b/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h @@ -27,4 +27,5 @@ class CPlayerRPCs : public CRPCFunctions DECLARE_ELEMENT_RPC(SetPlayerNametagShowing); DECLARE_ELEMENT_RPC(SetPlayerTeam); DECLARE_RPC(TakePlayerScreenShot); + DECLARE_ELEMENT_RPC(RemotePlayerSwitchWeapon); }; diff --git a/Server/mods/deathmatch/logic/CRPCFunctions.cpp b/Server/mods/deathmatch/logic/CRPCFunctions.cpp index d926c2a271..7eb1636602 100644 --- a/Server/mods/deathmatch/logic/CRPCFunctions.cpp +++ b/Server/mods/deathmatch/logic/CRPCFunctions.cpp @@ -17,6 +17,7 @@ #include "CElementIDs.h" #include "CWeaponNames.h" #include "CPerfStatManager.h" +#include "packets/CElementRPCPacket.h" #include "CKeyBinds.h" #include "CStaticFunctionDefinitions.h" #include "net/SyncStructures.h" @@ -178,6 +179,26 @@ void CRPCFunctions::PlayerWeapon(NetBitStreamInterface& bitStream) Arguments.PushNumber(m_pSourcePlayer->GetWeaponType(uiSlot)); m_pSourcePlayer->CallEvent("onPlayerWeaponSwitch", Arguments); + + SViewerMapType& nearList = m_pSourcePlayer->GetNearPlayerList(); + if (!nearList.empty()) + { + static std::vector playersInNearList; + playersInNearList.reserve(nearList.size()); + playersInNearList.clear(); + + for (const auto& player : nearList) + playersInNearList.push_back(player.first); + + if (!playersInNearList.empty()) + { + CBitStream BitStream; + BitStream.pBitStream->Write((unsigned int)ucPrevSlot); + BitStream.pBitStream->Write(uiSlot); + + m_pPlayerManager->Broadcast(CElementRPCPacket(m_pSourcePlayer, REMOTE_PLAYER_WEAPON_SWITCH, *BitStream.pBitStream), playersInNearList); + } + } } m_pSourcePlayer->SetWeaponSlot(uiSlot); diff --git a/Shared/sdk/net/rpc_enums.h b/Shared/sdk/net/rpc_enums.h index 2749267f09..05661039cf 100644 --- a/Shared/sdk/net/rpc_enums.h +++ b/Shared/sdk/net/rpc_enums.h @@ -104,6 +104,7 @@ enum eElementRPCFunctions TAKE_ALL_WEAPONS, SET_WEAPON_AMMO, SET_WEAPON_SLOT, + REMOTE_PLAYER_WEAPON_SWITCH, DESTROY_ALL_BLIPS, SET_BLIP_ICON, From 5d8d3756d98b0272687b87c30adca2961eee86c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 7 Jan 2024 01:45:33 +0000 Subject: [PATCH 4/6] Bump chromedriver from 114.0.2 to 119.0.1 in /utils/localization/generate-images (#3235) Bump [chromedriver](https://github.com/giggio/node-chromedriver) in in /utils/localization/generate-images from 114.0.2 to 119.0.1 --- .../generate-images/package-lock.json | 36 +++++++++---------- .../localization/generate-images/package.json | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/utils/localization/generate-images/package-lock.json b/utils/localization/generate-images/package-lock.json index f5cad8686b..20840d6030 100644 --- a/utils/localization/generate-images/package-lock.json +++ b/utils/localization/generate-images/package-lock.json @@ -10,7 +10,7 @@ "license": "GPL-3.0-or-later", "dependencies": { "@squoosh/lib": "~0.4.0", - "chromedriver": "^114.0.2", + "chromedriver": "^119.0.1", "fs-extra": "^11.1.1", "http-server": "^14.1.1", "selenium-webdriver": "^4.10.0" @@ -29,9 +29,9 @@ } }, "node_modules/@testim/chrome-version": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.1.3.tgz", - "integrity": "sha512-g697J3WxV/Zytemz8aTuKjTGYtta9+02kva3C1xc7KXB8GdbfE1akGJIsZLyY/FSh2QrnE+fiB7vmWU3XNcb6A==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.1.4.tgz", + "integrity": "sha512-kIhULpw9TrGYnHp/8VfdcneIcxKnLixmADtukQRtJUmsVlMg0niMkwV0xZmi8hqa57xqilIHjWFA0GKvEjVU5g==" }, "node_modules/@types/node": { "version": "20.3.0", @@ -87,9 +87,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", - "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", + "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -157,24 +157,24 @@ } }, "node_modules/chromedriver": { - "version": "114.0.2", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-114.0.2.tgz", - "integrity": "sha512-v0qrXRBknbxqmtklG7RWOe3TJ/dLaHhtB0jVxE7BAdYERxUjEaNRyqBwoGgVfQDibHCB0swzvzsj158nnfPgZw==", + "version": "119.0.1", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-119.0.1.tgz", + "integrity": "sha512-lpCFFLaXPpvElTaUOWKdP74pFb/sJhWtWqMjn7Ju1YriWn8dT5JBk84BGXMPvZQs70WfCYWecxdMmwfIu1Mupg==", "hasInstallScript": true, "dependencies": { - "@testim/chrome-version": "^1.1.3", - "axios": "^1.4.0", - "compare-versions": "^5.0.3", + "@testim/chrome-version": "^1.1.4", + "axios": "^1.6.0", + "compare-versions": "^6.1.0", "extract-zip": "^2.0.1", "https-proxy-agent": "^5.0.1", "proxy-from-env": "^1.1.0", - "tcp-port-used": "^1.0.1" + "tcp-port-used": "^1.0.2" }, "bin": { "chromedriver": "bin/chromedriver" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/color-convert": { @@ -205,9 +205,9 @@ } }, "node_modules/compare-versions": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-5.0.3.tgz", - "integrity": "sha512-4UZlZP8Z99MGEY+Ovg/uJxJuvoXuN4M6B3hKaiackiHrgzQFEe3diJi1mf1PNHbFujM7FvLrK2bpgIaImbtZ1A==" + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.0.tgz", + "integrity": "sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==" }, "node_modules/concat-map": { "version": "0.0.1", diff --git a/utils/localization/generate-images/package.json b/utils/localization/generate-images/package.json index 0fc7706232..44b6858046 100644 --- a/utils/localization/generate-images/package.json +++ b/utils/localization/generate-images/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@squoosh/lib": "~0.4.0", - "chromedriver": "^114.0.2", + "chromedriver": "^119.0.1", "fs-extra": "^11.1.1", "http-server": "^14.1.1", "selenium-webdriver": "^4.10.0" From ba018013085058905aa789c4fa3f39c4ed32fc69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 7 Jan 2024 01:46:01 +0000 Subject: [PATCH 5/6] Bump axios from 1.4.0 to 1.6.1 in /utils/localization/generate-images (#3239) Bump [axios](https://github.com/axios/axios) from 1.4.0 to 1.6.1 From e242f2295164d973dcb906d11400af40a74ddd77 Mon Sep 17 00:00:00 2001 From: Dutchman101 Date: Sun, 7 Jan 2024 06:38:49 +0100 Subject: [PATCH 6/6] Revert "Trigger onClientPlayerWeaponSwitch for Remote Players (#3238)" This reverts commit 7201ac5ae71ae181b6e3dfd46845a13cd89d8a7a. Refer to PR comments for details --- .../mods/deathmatch/logic/rpc/CPlayerRPCs.cpp | 17 --------------- .../mods/deathmatch/logic/rpc/CPlayerRPCs.h | 1 - .../mods/deathmatch/logic/CRPCFunctions.cpp | 21 ------------------- Shared/sdk/net/rpc_enums.h | 1 - 4 files changed, 40 deletions(-) diff --git a/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp b/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp index b438b02bf0..6756bace22 100644 --- a/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp +++ b/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp @@ -23,7 +23,6 @@ void CPlayerRPCs::LoadFunctions() AddHandler(SET_PLAYER_NAMETAG_SHOWING, SetPlayerNametagShowing, "SetPlayerNametagShowing"); AddHandler(SET_PLAYER_TEAM, SetPlayerTeam, "SetPlayerTeam"); AddHandler(TAKE_PLAYER_SCREEN_SHOT, TakePlayerScreenShot, "TakePlayerScreenShot"); - AddHandler(REMOTE_PLAYER_WEAPON_SWITCH, RemotePlayerSwitchWeapon, "RemotePlayerSwitchWeapon"); } void CPlayerRPCs::SetPlayerMoney(NetBitStreamInterface& bitStream) @@ -169,19 +168,3 @@ void CPlayerRPCs::TakePlayerScreenShot(NetBitStreamInterface& bitStream) m_pClientGame->TakePlayerScreenShot(usSizeX, usSizeY, strTag, ucQuality, uiMaxBandwidth, usMaxPacketSize, pResource, uiServerSentTime); } - -void CPlayerRPCs::RemotePlayerSwitchWeapon(CClientEntity* pSource, NetBitStreamInterface& bitStream) -{ - uint lastSlot, currentSlot; - if (bitStream.Read(lastSlot) && bitStream.Read(currentSlot)) - { - CClientPlayer* pPlayer = m_pPlayerManager->Get(pSource->GetID()); - if (IS_REMOTE_PLAYER(pPlayer)) - { - CLuaArguments Arguments; - Arguments.PushNumber(lastSlot); - Arguments.PushNumber(currentSlot); - pPlayer->CallEvent("onClientPlayerWeaponSwitch", Arguments, true); - } - } -} diff --git a/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h b/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h index 9a193f2ddb..ec60fd2c35 100644 --- a/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h +++ b/Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h @@ -27,5 +27,4 @@ class CPlayerRPCs : public CRPCFunctions DECLARE_ELEMENT_RPC(SetPlayerNametagShowing); DECLARE_ELEMENT_RPC(SetPlayerTeam); DECLARE_RPC(TakePlayerScreenShot); - DECLARE_ELEMENT_RPC(RemotePlayerSwitchWeapon); }; diff --git a/Server/mods/deathmatch/logic/CRPCFunctions.cpp b/Server/mods/deathmatch/logic/CRPCFunctions.cpp index 7eb1636602..d926c2a271 100644 --- a/Server/mods/deathmatch/logic/CRPCFunctions.cpp +++ b/Server/mods/deathmatch/logic/CRPCFunctions.cpp @@ -17,7 +17,6 @@ #include "CElementIDs.h" #include "CWeaponNames.h" #include "CPerfStatManager.h" -#include "packets/CElementRPCPacket.h" #include "CKeyBinds.h" #include "CStaticFunctionDefinitions.h" #include "net/SyncStructures.h" @@ -179,26 +178,6 @@ void CRPCFunctions::PlayerWeapon(NetBitStreamInterface& bitStream) Arguments.PushNumber(m_pSourcePlayer->GetWeaponType(uiSlot)); m_pSourcePlayer->CallEvent("onPlayerWeaponSwitch", Arguments); - - SViewerMapType& nearList = m_pSourcePlayer->GetNearPlayerList(); - if (!nearList.empty()) - { - static std::vector playersInNearList; - playersInNearList.reserve(nearList.size()); - playersInNearList.clear(); - - for (const auto& player : nearList) - playersInNearList.push_back(player.first); - - if (!playersInNearList.empty()) - { - CBitStream BitStream; - BitStream.pBitStream->Write((unsigned int)ucPrevSlot); - BitStream.pBitStream->Write(uiSlot); - - m_pPlayerManager->Broadcast(CElementRPCPacket(m_pSourcePlayer, REMOTE_PLAYER_WEAPON_SWITCH, *BitStream.pBitStream), playersInNearList); - } - } } m_pSourcePlayer->SetWeaponSlot(uiSlot); diff --git a/Shared/sdk/net/rpc_enums.h b/Shared/sdk/net/rpc_enums.h index 05661039cf..2749267f09 100644 --- a/Shared/sdk/net/rpc_enums.h +++ b/Shared/sdk/net/rpc_enums.h @@ -104,7 +104,6 @@ enum eElementRPCFunctions TAKE_ALL_WEAPONS, SET_WEAPON_AMMO, SET_WEAPON_SLOT, - REMOTE_PLAYER_WEAPON_SWITCH, DESTROY_ALL_BLIPS, SET_BLIP_ICON,