Sign in to follow this  

crash in asCCompiler::CompilatorOnHandles

Recommended Posts

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() )

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()).

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this