From 994b972d08f451871bdab46ac2ee3b885fe07a3e Mon Sep 17 00:00:00 2001 From: sigatrev Date: Sat, 21 Mar 2015 00:34:30 -0500 Subject: [PATCH] Prevent 2 AFT related crashes Attempting to create a texture of 0 size or a texture with a name that is already in use would crash SM. --- src/ActorFrameTexture.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ActorFrameTexture.cpp b/src/ActorFrameTexture.cpp index cbaf39c498..0943843561 100644 --- a/src/ActorFrameTexture.cpp +++ b/src/ActorFrameTexture.cpp @@ -37,10 +37,21 @@ void ActorFrameTexture::Create() { if( m_pRenderTarget != NULL ) { - LOG->Warn( "Can't Create an already created ActorFrameTexture" ); + LuaHelpers::ReportScriptError( "Can't Create an already created ActorFrameTexture" ); return; } + if( TEXTUREMAN->IsTextureRegistered( m_sTextureName ) ) + { + LuaHelpers::ReportScriptError( "ActorFrameTexture: Texture Name already in use." ); + return; + } + + if( (int)m_size.x < 1 || (int)m_size.y < 1 ) + { + LuaHelpers::ReportScriptError( "ActorFrameTexture: Cannot have width or height less than 1" ); + return; + } RageTextureID id( m_sTextureName ); id.Policy = RageTextureID::TEX_VOLATILE;