Jump to content
  • Advertisement
Sign in to follow this  

crash in asCCompiler::CompilatorOnHandles

This topic is 3409 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!