crash in asCCompiler::CompilatorOnHandles

Started by
3 comments, last by WitchLord 15 years, 1 month ago
A very simple line of AS code causes a crash in asCCompiler::CompilatorOnHandles
8543: if( (node->tokenType == ttEqual || node->tokenType == ttNotEqual) &&
8544: ((!lctx->type.isExplicitHandle && !(lctx->type.dataType.GetObjectType()->flags & asOBJ_IMPLICIT_HANDLE)) ||
8545:  (!rctx->type.isExplicitHandle && !(rctx->type.dataType.GetObjectType()->flags & asOBJ_IMPLICIT_HANDLE))) )


The crash is caused by the following lines if the getClient() method does not exist:
if( @other.client == ent.getClient() )


or
if( ent.getClient() == @other.client )


Depending on the order of operands library crashes either on line 8544 or line 8545 (referencing NULL pointer at dataType->GetObjectType()).
Advertisement
I'll look into this. Thanks.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

The fix for this is simple. Just check if the GetObjectType() method returns null before checking the flags.

	if( (node->tokenType == ttEqual || node->tokenType == ttNotEqual) &&		((!lctx->type.isExplicitHandle && !(lctx->type.dataType.GetObjectType() && (lctx->type.dataType.GetObjectType()->flags & asOBJ_IMPLICIT_HANDLE))) ||		 (!rctx->type.isExplicitHandle && !(rctx->type.dataType.GetObjectType() && (rctx->type.dataType.GetObjectType()->flags & asOBJ_IMPLICIT_HANDLE)))) )


It only crashed if the types were not valid handle types, in this case because of ent.getClient() not existing.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This is exactly the same fix I applied to my local version of AS yesterday, thanks :)
The fix has now been checked in.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement