From 7beff3d0cc5597316360d38fe494195ae74d86c4 Mon Sep 17 00:00:00 2001 From: iAmir Date: Thu, 21 Sep 2023 16:39:13 +0330 Subject: [PATCH 1/5] add more queryExtension return value sanity checks --- Server/Components/Pawn/Scripting/TextLabel/Natives.cpp | 7 ++++++- Server/Components/Pickups/pickups_main.cpp | 6 ++++++ Server/Components/Vehicles/vehicle.cpp | 9 +++++++++ Server/Components/Vehicles/vehicles_impl.hpp | 7 ++++++- Server/Source/player_pool.hpp | 2 +- 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Server/Components/Pawn/Scripting/TextLabel/Natives.cpp b/Server/Components/Pawn/Scripting/TextLabel/Natives.cpp index b0ad1079f..b74cef840 100644 --- a/Server/Components/Pawn/Scripting/TextLabel/Natives.cpp +++ b/Server/Components/Pawn/Scripting/TextLabel/Natives.cpp @@ -152,7 +152,12 @@ SCRIPT_API_FAILRET(CreatePlayer3DTextLabel, INVALID_TEXT_LABEL_ID, int(IPlayer& SCRIPT_API(DeletePlayer3DTextLabel, bool(IPlayer& player, IPlayerTextLabel& textlabel)) { - queryExtension(player)->release(textlabel.getID()); + auto data = queryExtension(player); + if(!data) + { + return false; + } + data->release(textlabel.getID()); return true; } diff --git a/Server/Components/Pickups/pickups_main.cpp b/Server/Components/Pickups/pickups_main.cpp index b18469775..e6d2fd01c 100644 --- a/Server/Components/Pickups/pickups_main.cpp +++ b/Server/Components/Pickups/pickups_main.cpp @@ -120,7 +120,13 @@ class PickupsComponent final : public IPickupsComponent, public PlayerConnectEve { return false; } + auto data = queryExtension(peer); + if(!data) + { + return false; + } + int id = data->fromClientID(onPlayerPickUpPickupRPC.PickupID); if (!id) { diff --git a/Server/Components/Vehicles/vehicle.cpp b/Server/Components/Vehicles/vehicle.cpp index 4ac9c5316..c960b9473 100644 --- a/Server/Components/Vehicles/vehicle.cpp +++ b/Server/Components/Vehicles/vehicle.cpp @@ -322,6 +322,11 @@ bool Vehicle::updateFromTrailerSync(const VehicleTrailerSyncPacket& trailerSync, updateOccupied(); PlayerVehicleData* playerData = queryExtension(player); + if (!playerData) + { + return false; + } + Vehicle* vehicle = static_cast(playerData->getVehicle()); if (!vehicle || vehicle->detaching) @@ -369,6 +374,10 @@ bool Vehicle::updateFromTrailerSync(const VehicleTrailerSyncPacket& trailerSync, bool Vehicle::updateFromPassengerSync(const VehiclePassengerSyncPacket& passengerSync, IPlayer& player) { PlayerVehicleData* data = queryExtension(player); + if (!data) + { + return false; + } // Only do heavy processing if switching vehicle or switching between driver and passenger int passengerSeats = Impl::getVehiclePassengerSeats(getModel()); // TODO: Deal with two players in the same seat. diff --git a/Server/Components/Vehicles/vehicles_impl.hpp b/Server/Components/Vehicles/vehicles_impl.hpp index 72b517dd3..492e3378d 100644 --- a/Server/Components/Vehicles/vehicles_impl.hpp +++ b/Server/Components/Vehicles/vehicles_impl.hpp @@ -91,7 +91,7 @@ class VehiclesComponent final : public IVehiclesComponent, public CoreEventHandl } IPlayerVehicleData* vehData = queryExtension(peer); - if (!lock.entry->isStreamedInForPlayer(peer) || !(peer.getState() == PlayerState_Driver || peer.getState() == PlayerState_Passenger) || vehData->getVehicle() != lock.entry) + if (vehData == nullptr || !lock.entry->isStreamedInForPlayer(peer) || !(peer.getState() == PlayerState_Driver || peer.getState() == PlayerState_Passenger) || vehData->getVehicle() != lock.entry) { return false; } @@ -126,6 +126,11 @@ class VehiclesComponent final : public IVehiclesComponent, public CoreEventHandl } PlayerVehicleData* data = queryExtension(peer); + if (!data) + { + return false; + } + IVehicle* vehicle = data->getVehicle(); if (vehicle && vehicle->getDriver() == &peer) { diff --git a/Server/Source/player_pool.hpp b/Server/Source/player_pool.hpp index 893e4183e..9fa39d9c3 100644 --- a/Server/Source/player_pool.hpp +++ b/Server/Source/player_pool.hpp @@ -1494,7 +1494,7 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public Player& player = static_cast(peer); PlayerState state = player.getState(); IPlayerVehicleData* vehData = queryExtension(peer); - if (state != PlayerState_Driver || vehData->getVehicle() == nullptr) + if (state != PlayerState_Driver || vehData == nullptr || vehData->getVehicle() == nullptr) { return false; } From c2c1b5e16846aaaa01d0c880793fe05c28f385b4 Mon Sep 17 00:00:00 2001 From: iAmir Date: Thu, 21 Sep 2023 16:39:22 +0330 Subject: [PATCH 2/5] update cmake-conan --- SDK/lib/cmake-conan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDK/lib/cmake-conan b/SDK/lib/cmake-conan index 4707c092a..39f353b2e 160000 --- a/SDK/lib/cmake-conan +++ b/SDK/lib/cmake-conan @@ -1 +1 @@ -Subproject commit 4707c092a5da1ac5590cd9409f1ee3499b577827 +Subproject commit 39f353b2ee50fca2f66bb5e0717c9d0dbf8a9c3e From 84edfaf6cad71925d45f1ee69a071f6c5150f90a Mon Sep 17 00:00:00 2001 From: iAmir Date: Thu, 21 Sep 2023 16:41:46 +0330 Subject: [PATCH 3/5] fix formatting --- Server/Components/Pawn/Scripting/TextLabel/Natives.cpp | 2 +- Server/Components/Pickups/pickups_main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/Components/Pawn/Scripting/TextLabel/Natives.cpp b/Server/Components/Pawn/Scripting/TextLabel/Natives.cpp index b74cef840..37feacee6 100644 --- a/Server/Components/Pawn/Scripting/TextLabel/Natives.cpp +++ b/Server/Components/Pawn/Scripting/TextLabel/Natives.cpp @@ -153,7 +153,7 @@ SCRIPT_API_FAILRET(CreatePlayer3DTextLabel, INVALID_TEXT_LABEL_ID, int(IPlayer& SCRIPT_API(DeletePlayer3DTextLabel, bool(IPlayer& player, IPlayerTextLabel& textlabel)) { auto data = queryExtension(player); - if(!data) + if (!data) { return false; } diff --git a/Server/Components/Pickups/pickups_main.cpp b/Server/Components/Pickups/pickups_main.cpp index e6d2fd01c..6713d4a55 100644 --- a/Server/Components/Pickups/pickups_main.cpp +++ b/Server/Components/Pickups/pickups_main.cpp @@ -122,7 +122,7 @@ class PickupsComponent final : public IPickupsComponent, public PlayerConnectEve } auto data = queryExtension(peer); - if(!data) + if (!data) { return false; } From 5e96d8fa89e4a64d53111164c06b839f9114ca96 Mon Sep 17 00:00:00 2001 From: iAmir Date: Fri, 22 Sep 2023 09:57:10 +0330 Subject: [PATCH 4/5] attempt to fix arm ci --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a622db793..965d9d1f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -274,8 +274,8 @@ jobs: cpu: cortex-a7 commands: | apt update && apt install -y ninja-build clang-11 python3-pip libstdc++6 libc6 - pip3 install --user -v "conan==1.57.0" - pip3 install --user -v "cmake==3.23.3" + pip3 install --user -v "conan==1.59.0" + pip3 install --user cmake export CC=/usr/bin/clang-11 export CXX=/usr/bin/clang++-11 export PATH=~/.local/bin:${PATH} From a696381849a613dfbd27432bd9b4761404a54d5a Mon Sep 17 00:00:00 2001 From: iAmir Date: Fri, 22 Sep 2023 10:08:44 +0330 Subject: [PATCH 5/5] attempt to fix arm ci 2 --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 965d9d1f5..73475ad63 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -274,8 +274,9 @@ jobs: cpu: cortex-a7 commands: | apt update && apt install -y ninja-build clang-11 python3-pip libstdc++6 libc6 + pip install --upgrade pip setuptools wheel pip3 install --user -v "conan==1.59.0" - pip3 install --user cmake + pip3 install --user -v "cmake==3.23.3" export CC=/usr/bin/clang-11 export CXX=/usr/bin/clang++-11 export PATH=~/.local/bin:${PATH}