mesecons icon indicating copy to clipboard operation
mesecons copied to clipboard

Invalid `vector.add` crashes server

Open appgurueu opened this issue 3 years ago • 5 comments
trafficstars

See https://github.com/minetest-mods/wielded_light/issues/21:

ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'wielded_light' in callback environment_Step(): ...i/github/minetest-5.5.0/bin/../builtin/common/vector.lua:154: attempt to perform arithmetic on field 'x' (a nil value)
ERROR[Main]: stack traceback:
ERROR[Main]: 	...i/github/minetest-5.5.0/bin/../builtin/common/vector.lua:154: in function 'add'
ERROR[Main]: 	...ub/minetest-5.5.0/bin/../mods/mesecons/mesecons/init.lua:98: in function <...ub/minetest-5.5.0/bin/../mods/mesecons/mesecons/init.lua:93>
ERROR[Main]: 	...test-5.5.0/bin/../mods/mesecons/mesecons/actionqueue.lua:137: in function 'execute'
ERROR[Main]: 	...test-5.5.0/bin/../mods/mesecons/mesecons/actionqueue.lua:111: in function <...test-5.5.0/bin/../mods/mesecons/mesecons/actionqueue.lua:73>
ERROR[Main]: 	...i/github/minetest-5.5.0/bin/../builtin/game/register.lua:425: in function <...i/github/minetest-5.5.0/bin/../builtin/game/register.lua:409>

appgurueu avatar Apr 27 '22 20:04 appgurueu

@debagos Did you have any other mods enabled that used mesecons?

TurkeyMcMac avatar Apr 29 '22 12:04 TurkeyMcMac

@TurkeyMcMac Plenty: awards, cannons, christmas_decor, digilines, ezmod_nodes, fireworkz, handdryer, handle_schematics, homedecor, laptop, led_marquee, morelights, nether, nuke, particlefountain, pipeworks, soccer, technic, terumet, travelnet, unified_inventory, unifieddyes, xdecor, WorldEdit

debagos avatar Apr 30 '22 22:04 debagos

Could you provide ZIP archives of the mods you didn't get on ContentDB?

TurkeyMcMac avatar Apr 30 '22 23:04 TurkeyMcMac

I doubt that will help. Most of these mods are running like that for over a year now. But a while ago I used a bugged LuaJIT version which caused SIGSEGV and I think there is some broken (meta)data now. So I think the job is done with adding some NiL checks?

debagos avatar Apr 30 '22 23:04 debagos

The stack trace suggests that a function was passed a position that was not nil but whose x field was nil. I thought this might be due to invalid usage of the API in some rare case, but it could be due to data corruption. If the interpreter is bugged, you never know.

TurkeyMcMac avatar Apr 30 '22 23:04 TurkeyMcMac

Not our bug. Someone had to pass that invalid vector to Mesecons.

Now, intercepting invalid arguments at API level (mesecon.receptor_off in this case) is possible. It is also possible to copy the arguments there to avoid pass-by-reference surprises (it’s sad Lua lacks immutable types). But that’d be a feature, not a bugfix.

numberZero avatar Mar 18 '23 20:03 numberZero

See also #637.

numberZero avatar Mar 18 '23 21:03 numberZero