cuberite icon indicating copy to clipboard operation
cuberite copied to clipboard

Fix unknown Monster Family crashing the server (see #5442)

Open tonitch opened this issue 3 years ago • 1 comments

Should solve #5442 I'm sorry for the other pr, I just messed it up so I make a new one...

Fixes #5442

tonitch avatar Sep 27 '22 11:09 tonitch

Will this work if you pass -2? i.e. I think the problem is Lua calling C++ with arbitrary integer values but C++ not expecting them since it works based off the fixed set of enumeration values. I would suggest writing a manual binding similar to this and adding a manual error check like so: https://github.com/cuberite/cuberite/blob/3b2a501524eb4cd23e53cf5ddb04ea8a615f0460/src/Bindings/ManualBindings_World.cpp#L962-L965 to cleanly report to the plugin that it did something wrong.

Something like if pluginmonstertype < mtInvalidType || pluginmonstertype > zombievillager { error } else { call cMonster::FamilyFromType(pluginmonstertype) }

tigerw avatar Nov 02 '22 01:11 tigerw