Fix physobj OOB access (#483)

* Fix physobj OOB access

* Fix broken contributing link
This commit is contained in:
thecraftianman 2024-11-02 08:09:48 +00:00 committed by GitHub
parent ac5f1f202a
commit 41d4fa6f2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# Coding Guidelines
Please see https://github.com/wiremod/wire/wiki/Coding-style for information on how code formatting is standardized in the Wiremod project.
Please see https://github.com/wiremod/wire/wiki/Developer-Style-Guide for information on how code formatting is standardized in the Wiremod project.
---

View File

@ -1415,8 +1415,10 @@ local function AdvDupe2_Spawn()
edit = false
end
local physCount = v:GetPhysicsObjectCount() - 1
if (unfreeze) then
for i = 0, v:GetPhysicsObjectCount() do
for i = 0, physCount do
phys = v:GetPhysicsObjectNum(i)
if (IsValid(phys)) then
phys:EnableMotion(true) -- Unfreeze the entitiy and all of its objects
@ -1424,7 +1426,7 @@ local function AdvDupe2_Spawn()
end
end
elseif (preservefrozenstate) then
for i = 0, v:GetPhysicsObjectCount() do
for i = 0, physCount do
phys = v:GetPhysicsObjectNum(i)
if (IsValid(phys)) then
if (Queue.EntityList[k].BuildDupeInfo.PhysicsObjects[i].Frozen) then
@ -1436,7 +1438,7 @@ local function AdvDupe2_Spawn()
end
end
else
for i = 0, v:GetPhysicsObjectCount() do
for i = 0, physCount do
phys = v:GetPhysicsObjectNum(i)
if (IsValid(phys)) then
if (phys:IsMoveable()) then