Page 1 of 1

[Twinsen][1.1.109][switch] Crash when focusing on a script created text-box longer than 512 chars

Posted: Sun Aug 25, 2024 4:15 am
by chrisgbk
Hard crash, completely closes.

Following minimal scenario was hosted on PC server and connected to with switch (see attachment for zip version to extract to scenarios folder):

Code: Select all

script.on_event(defines.events.on_player_joined_game, function(e)
    local player = game.players[e.player_index]
	local edit = player.gui.center.add{type = 'text-box'}
	edit.word_wrap = true
	edit.style.width = 600
	edit.style.height = 200
	edit.text = string.rep('a', 480) .. '\n\nclick to crash switch (not pc)\n\n'
end)
Smaller strings are fine, only >512 character strings cause an issue, possibly a buffer overflow.

Re: [Twinsen][1.1.109][switch] Crash when focusing on a script created text-box longer than 512 chars

Posted: Thu Jan 09, 2025 6:29 pm
by Twinsen
Thanks for the detailed report.
This is a limitation of the Nintendo Switch on-screen keyboard.
I fixed it by truncating the string to the maximum allowed length(only 500) when using the keyboard. Not ideal but better than not allowing it to be edited at all.
Fixed for Version: 2.0.30