Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow LCD messages that aren't strings or numbers #89

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Disallow LCD messages that aren't strings or numbers #89

merged 1 commit into from
Sep 9, 2024

Conversation

cheapie
Copy link
Contributor

@cheapie cheapie commented Sep 1, 2024

This fixes a crash (that seems to only happen in 5.9?) that occurs if a table is sent to an LCD.

@SmallJoker
Copy link
Member

Do you happen to have an error backtrace? Whereas this fix surely works, I am not sure whether that's the best way to fix such issue.

@cheapie
Copy link
Contributor Author

cheapie commented Sep 6, 2024

The exact backtrace varies slightly depending on where the message came from, but with a minimal reproduction (Luacontroller connected to LCD, LCD on channel "lcd", Luacontroller programmed with digiline_send("lcd",{}) as the only line):

2024-09-06 07:35:20: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'mesecons' in callback environment_Step(): /home/cheapie/.minetest/mods/digilines/lcd.lua:262: bad argument #2 to 'set_string' (string expected, got table)
2024-09-06 07:35:20: ERROR[Main]: stack traceback:
2024-09-06 07:35:20: ERROR[Main]: 	[C]: in function 'set_string'
2024-09-06 07:35:20: ERROR[Main]: 	/home/cheapie/.minetest/mods/digilines/lcd.lua:262: in function 'action'
2024-09-06 07:35:20: ERROR[Main]: 	/home/cheapie/.minetest/mods/digilines/internal.lua:106: in function 'transmit'
2024-09-06 07:35:20: ERROR[Main]: 	/home/cheapie/.minetest/mods/digilines/init.lua:60: in function 'receptor_send'
2024-09-06 07:35:20: ERROR[Main]: 	.../.minetest/mods/mesecons/mesecons_luacontroller/init.lua:752: in function <.../.minetest/mods/mesecons/mesecons_luacontroller/init.lua:746>
2024-09-06 07:35:20: ERROR[Main]: 	...cheapie/.minetest/mods/mesecons/mesecons/actionqueue.lua:131: in function 'execute'
2024-09-06 07:35:20: ERROR[Main]: 	...cheapie/.minetest/mods/mesecons/mesecons/actionqueue.lua:121: in function 'func'
2024-09-06 07:35:20: ERROR[Main]: 	...ocal/share/minetest/builtin/profiler/instrumentation.lua:124: in function <...ocal/share/minetest/builtin/profiler/instrumentation.lua:117>
2024-09-06 07:35:20: ERROR[Main]: 	/usr/local/share/minetest/builtin/common/register.lua:26: in function </usr/local/share/minetest/builtin/common/register.lua:12>

For the original crash I observed on a server elsewhere (this one mentions digistuff because the message came from there):

2024-09-01 18:37:26: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '' in callback node_on_receive_fields(): /home/medic/worlds/creative/worldmods/digilines/lcd.lua:262: bad argument #2 to 'set_string' (string expected, got table)
2024-09-01 18:37:26: ERROR[Main]: stack traceback:
2024-09-01 18:37:26: ERROR[Main]: 	[C]: in function 'set_string'
2024-09-01 18:37:26: ERROR[Main]: 	/home/medic/worlds/creative/worldmods/digilines/lcd.lua:262: in function 'action'
2024-09-01 18:37:26: ERROR[Main]: 	...e/medic/worlds/creative/worldmods/digilines/internal.lua:106: in function 'transmit'
2024-09-01 18:37:26: ERROR[Main]: 	/home/medic/worlds/creative/worldmods/digilines/init.lua:60: in function 'receptor_send'
2024-09-01 18:37:26: ERROR[Main]: 	...edic/worlds/creative/worldmods/digistuff/touchscreen.lua:81: in function <...edic/worlds/creative/worldmods/digistuff/touchscreen.lua:60>

@SmallJoker
Copy link
Member

I see. Yes, that makes sense to me. Thank you for explaining.

Will merge in a few days unless there are objections.

@SmallJoker SmallJoker merged commit 7d4895d into minetest-mods:master Sep 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants