tulir / gomuks

A Matrix client written in Go.
https://maunium.net/go/gomuks
GNU Affero General Public License v3.0
1.36k stars 120 forks source link

Off-by-one error in FuzzySearchModal #272

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi,

Thank you for your great work on gomuks! I have experienced the following reproducible crash:

This will panic with the following output:

panic: runtime error: index out of range [1] with length 1 [recovered]
    panic: runtime error: index out of range [1] with length 1 [recovered]
    panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
maunium.net/go/gomuks/debug.Recover()
    debug/debug.go:109 +0x98
panic(0xe55340, 0xc000e6b578)
    /usr/lib/go/src/runtime/panic.go:965 +0x1b9
maunium.net/go/mauview.(*Application).Start.func1(0xc00006cfc0)
    /home/sparrowhawk/projects/soft/go/pkg/mod/maunium.net/go/mauview@v0.1.2/application.go:104 +0x87
panic(0xe55340, 0xc000e6b578)
    /usr/lib/go/src/runtime/panic.go:965 +0x1b9
maunium.net/go/gomuks/ui.(*FuzzySearchModal).OnKeyEvent(0xc000e88600, 0x142b538, 0xc000356300, 0xc0009a9600)
    ui/fuzzy-search-modal.go:148 +0x6b2
maunium.net/go/gomuks/ui.(*MainView).OnKeyEvent(0xc000354000, 0x142b538, 0xc000356300, 0x0)
    ui/view-main.go:170 +0x3d4
maunium.net/go/mauview.(*Application).Start(0xc00006cfc0, 0x0, 0x0)
    /home/sparrowhawk/projects/soft/go/pkg/mod/maunium.net/go/mauview@v0.1.2/application.go:155 +0x390
maunium.net/go/gomuks/ui.(*GomuksUI).Start(0xc0001f4de0, 0xf707d0, 0xc0001f4db0)
    ui/ui.go:75 +0x2f
main.(*Gomuks).Start(0xc0001f4db0)
    gomuks.go:115 +0x11d
main.main()
    main.go:83 +0x5a5

Using archlinux with gomuks 0.2.3-1 installed from the AUR. I unfortunately do not speak go, so I can't propose a patch, sorry. Please ask if you need any additional information!

Cheers,

tulir commented 3 years ago

I think this is a duplicate of #268