You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug replaceAction checks if a string has the prefix _ and the suffix _. A string of length 1, "_", passes this check.
To Reproduce
Steps to reproduce the behavior, on Discord type this:
/me hello
Click on "Edit message"
Change _hello_ to just _
panic
Expected behavior
No panic
Screenshots/debug logs
panic: runtime error: slice bounds out of range [1:0]
goroutine 206785 [running]:
github.com/42wim/matterbridge/bridge/discord.(*Bdiscord).replaceAction(...)
/home/qaisjp/apps/matterbridge/bridge/discord/helpers.go:192
github.com/42wim/matterbridge/bridge/discord.(*Bdiscord).messageCreate(0xc000409110, 0xc0004d28c0, 0xc0024db7e0)
/home/qaisjp/apps/matterbridge/bridge/discord/handlers.go:122 +0xbe5
github.com/matterbridge/discordgo.messageCreateEventHandler.Handle(0xc0005bc000, 0xc0004d28c0, 0x1841320, 0xc0024db7e0)
/home/qaisjp/apps/matterbridge/vendor/github.com/matterbridge/discordgo/eventhandlers.go:497 +0x57
created by github.com/matterbridge/discordgo.(*Session).handle
/home/qaisjp/apps/matterbridge/vendor/github.com/matterbridge/discordgo/event.go:171 +0x10e
Environment (please complete the following information):
Version based on 1.17.1, with some PRs cherry-picked. But replaceAction hasn't changed in months.
linux
Additional context
Line 191 needs length check to fix this
Describe the bug
replaceAction
checks if a string has the prefix_
and the suffix_
. A string of length 1,"_"
, passes this check.To Reproduce
Steps to reproduce the behavior, on Discord type this:
/me hello
_hello_
to just_
Expected behavior
No panic
Screenshots/debug logs
Environment (please complete the following information):
Version based on 1.17.1, with some PRs cherry-picked. But
replaceAction
hasn't changed in months.linux
Additional context
Line 191 needs length check to fix this
matterbridge/bridge/discord/helpers.go
Lines 190 to 195 in a18cb74
The text was updated successfully, but these errors were encountered: