Installing both Omit_Blank_Lines and some other plugin causes crash

Posted by KidZero on Fri 11 May 2018 12:13 AM — 4 posts, 18,229 views.

#0
Versions tested:
Fiendish's aard package, 5.06 pre
Latest source from github

How to create a crash:
- Open a world (aardwolf in my case) with many aard_* plugins installed
- Go to plugins, try to add Omit_Blank_Lines
- Mushclient.exe crashes with access violation

Also:
- Clear the world of all plugins
- Add Omit_Blank_Lines, no crash
- Try to add some aard_* plugin (I tried aardwolf_gmcp_mapper)
- Crash

VS debugging shows a null pointer exception of "this" being empty. Call stack:

MUSHclient.exe!CScriptEngine::GetDispid(const ATL::CStringT<char,StrTraitMFC<char,ATL::ChTraitsCRT<char> > > & strName) - line 485

MUSHclient.exe!CMUSHclientDoc::PluginSupports(const char * PluginID, const char * Routine) - line 482

MUSHclient.exe!L_PluginSupports(lua_State * L) - line 4835

CMushclientDoc::PluginSupports does not check whether pPlugin -> m_scriptEngine is NULL. This check is being done in CMUSHclientDoc::CallPlugin, though.

I would suggest adding a null check of m_scriptEngine to CMushclientDoc::PluginSupports. However, I'm no expert at C++ let alone mushclient client code, so please forgive my ignorance if this behavior is intended.
USA Global Moderator #1
Oh wow.

I can totally reproduce it too.

Man, what a find.

The problem occurs when calling PluginSupports on that plugin, regardless of what else is installed. And the problem goes away if you add <script>print("foo")</script> to the plugin. So, yeah, the suggestion seems good.
Amended on Fri 11 May 2018 12:57 AM by Fiendish
Australia Forum Administrator #2

Yes, well spotted.

Fixed in the latest pre-release. See here for how to obtain that.

Patch 079ba7f at GitHub.

Presumably if a plugin has no script at all, then it wouldn’t support the function being asked about.

Australia Forum Administrator #3
And thanks very much for such a detailed bug description. You described exactly what caused the problem, and how to reproduce it, and also suggested a fix.