Skip to content

Commit

Permalink
Fixed longstanding thruster crash
Browse files Browse the repository at this point in the history
Through testing, I've found that setting the force to a number larger than 36 digits long will instantly crash the server when activated. The thruster tool allow users to enter any unclamped force value they want. This has been an issue for many years.

If this pull request isn't accepted due to differing methods of solving this problem, please at least address it with an official patch.

Thanks.
  • Loading branch information
Mista-Tea committed May 23, 2014
1 parent bdad5af commit 6160c8f
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -25,7 +25,7 @@ function TOOL:LeftClick( trace )

local ply = self:GetOwner()

local force = self:GetClientNumber( "force" )
local force = math.Clamp( self:GetClientNumber( "force" ), 0, 1E35 ) -- prevent high force value crash
local model = self:GetClientInfo( "model" )
local key = self:GetClientNumber( "keygroup" )
local key_bk = self:GetClientNumber( "keygroup_back" )
Expand Down Expand Up @@ -124,7 +124,9 @@ if (SERVER) then
thruster:SetAngles( Ang )
thruster:SetPos( Pos )
thruster:Spawn()


force = math.Clamp( force, 0, 1E35 ) -- prevent high force value crash

thruster:SetEffect( effect )
thruster:SetForce( force )
thruster:SetToggle( toggle == 1 )
Expand Down

0 comments on commit 6160c8f

Please sign in to comment.