BuckarooBanzay / digibuilder

0 stars 2 forks source link

bad bad crash bug #21

Closed TheEt1234 closed 6 months ago

TheEt1234 commented 6 months ago
digiline_send("digibuilder",{
pos = {x = 0, y = 1, z = 0},
name = "scifi_nodes:white2",
param2 = 255,
command = "setnode"
})

Crashes the server

Crash log - from pandorabox

2024-05-05 18:01:53: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '??' in callback environment_Step(): /data/world//worldmods/digibuilder/digiline.lua:218: attempt to index local 'dir' (a nil value)
2024-05-05 18:01:53: ERROR[Main]: stack traceback:
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/digibuilder/digiline.lua:218: in function 'action'
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/digicontrol/override.lua:45: in function 'f'
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/monitoring/metrictypes/counter.lua:43: in function 'transmit'
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/digicontrol/override.lua:78: in function 'f'
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/monitoring/metrictypes/counter.lua:43: in function 'receptor_send'
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/mooncontroller/controller.lua:714: in function </data/world//worldmods/mooncontroller/controller.lua:708>
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/mesecons/mesecons/actionqueue.lua:137: in function 'f'
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/monitoring/metrictypes/counter.lua:43: in function 'old_execute'
2024-05-05 18:01:53: ERROR[Main]:   ...d//worldmods/mesecons_debug/overrides/mesecons_queue.lua:27: in function 'execute'
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/mesecons/mesecons/actionqueue.lua:111: in function 'globalstep'
2024-05-05 18:01:53: ERROR[Main]:   /data/world//worldmods/monitoring/builtin/globalstep.lua:73: in function </data/world//worldmods/monitoring/builtin/globalstep.lua:55>
2024-05-05 18:01:53: ERROR[Main]:   /usr/local/share/minetest/builtin/common/register.lua:26: in function </usr/local/share/minetest/builtin/common/register.lua:12>

Accidentally done this in the main pandorabox server, and reproduced it in the test server

Also param2 isn't used just for rotation, it can also be used for color, but i think it would be more fun if this bug was just... fixed rather than param2 setnode'ing being limited more oh wait no param2 is checked

OgelGames commented 6 months ago

The problem is param2 = 255 is not valid for paramtype2 = "facedir" nodes, but the comment in the code states that only facedir nodes can have their param2 set: https://github.com/BuckarooBanzay/digibuilder/blob/84ca01da026bcedfa7ac7790c794caa6a742229e/digiline.lua#L188-L236

BuckarooBanzay commented 6 months ago

thanks, the current fix adds some default values in case the param2 is invalid or not set

OgelGames commented 6 months ago

That didn't fix it, the default value gets overridden by the nil value.