tulir / gomuks

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

Pasting Images from Clipboard Crashes the App #170

Closed dinodude7777 closed 3 weeks ago

dinodude7777 commented 4 years ago

Pasting with an image copied on the clipboard causes a crash. Using Manjaro with gomuks installed via gomuks-git Error:

panic: runtime error: slice bounds out of range [209:203] [recovered]
    panic: runtime error: slice bounds out of range [209:203] [recovered]
    panic: runtime error: slice bounds out of range [209:203]

goroutine 1 [running]:
maunium.net/go/gomuks/debug.Recover()
    debug/debug.go:109 +0x96
panic(0x55b01f98bd40, 0xc0009ecb00)
    /usr/lib/go/src/runtime/panic.go:969 +0x16a
maunium.net/go/mauview.(*Application).Start.func1(0xc000405740)
    /home/dino/go/pkg/mod/maunium.net/go/mauview@v0.1.1/application.go:99 +0x84
panic(0x55b01f98bd40, 0xc0009ecb00)
    /usr/lib/go/src/runtime/panic.go:969 +0x16a
maunium.net/go/mauview.(*InputArea).prepareText(0xc0000fb7c0, 0x5b)
    /home/dino/go/pkg/mod/maunium.net/go/mauview@v0.1.1/inputarea.go:357 +0x3de
maunium.net/go/mauview.(*InputArea).PrepareDraw(0xc0000fb7c0, 0x5b)
    /home/dino/go/pkg/mod/maunium.net/go/mauview@v0.1.1/inputarea.go:417 +0x37
maunium.net/go/gomuks/ui.(*RoomView).Draw(0xc0000fb900, 0x55b01f9f1f20, 0xc0002ffa00)
    ui/room-view.go:296 +0x136
maunium.net/go/mauview.(*Box).Draw(0xc000190930, 0x55b01f9f1f20, 0xc0002ffb00)
    /home/dino/go/pkg/mod/maunium.net/go/mauview@v0.1.1/box.go:184 +0x129
maunium.net/go/mauview.(*Flex).Draw(0xc000513800, 0x7f67a451d008, 0xc0001d7400)
    /home/dino/go/pkg/mod/maunium.net/go/mauview@v0.1.1/flex.go:110 +0x226
maunium.net/go/gomuks/ui.(*MainView).Draw(0xc0004ecdc0, 0x7f67a451d008, 0xc0001d7400)
    ui/view-main.go:109 +0xb5
maunium.net/go/mauview.(*Application).redraw(0xc000405740)
    /home/dino/go/pkg/mod/maunium.net/go/mauview@v0.1.1/application.go:216 +0x9b
maunium.net/go/mauview.(*Application).Start(0xc000405740, 0x0, 0x0)
    /home/dino/go/pkg/mod/maunium.net/go/mauview@v0.1.1/application.go:151 +0x3e7
maunium.net/go/gomuks/ui.(*GomuksUI).Start(0xc000331080, 0x55b01f9d47a0, 0xc000331050)
    ui/ui.go:73 +0x31
main.(*Gomuks).Start(0xc000331050)
    gomuks.go:115 +0x11e
main.main()
    main.go:77 +0x486
ghost commented 4 years ago

Same problem here (see gif below)

2020_05_19__11_37_33

Is there any way to send an image which is in the clipboard from within gomuks?

wvffle commented 4 years ago

With more recent version of gomuks (114940eef67491d6eefbb63b575599024726c82d) I'm experiencing a panic as well. However the panic happens to take place in zyedidia/clipboard and only when an image is in clipboard.

panic: runtime error: slice bounds out of range [1:0] [recovered]
        panic: runtime error: slice bounds out of range [1:0] [recovered]
        panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
maunium.net/go/gomuks/debug.Recover()
        /home/waff/workspace/gomuks/debug/debug.go:109 +0x98
panic(0xc6ac80, 0xc0029ab3a0)
        /usr/lib/go/src/runtime/panic.go:969 +0x1b9
maunium.net/go/mauview.(*Application).Start.func1(0xc000542240)
        /home/waff/go/pkg/mod/maunium.net/go/mauview@v0.1.2/application.go:104 +0x87
panic(0xc6ac80, 0xc0029ab3a0)
        /usr/lib/go/src/runtime/panic.go:969 +0x1b9
github.com/zyedidia/clipboard.getPasteCommand(...)
        /home/waff/go/pkg/mod/github.com/zyedidia/clipboard@v1.0.3/clipboard_unix.go:150
github.com/zyedidia/clipboard.readAll(0xccd703, 0x9, 0x8e3b3c, 0xc0043f9400, 0xc70000, 0xc003417bd8)
        /home/waff/go/pkg/mod/github.com/zyedidia/clipboard@v1.0.3/clipboard_unix.go:164 +0x20f
github.com/zyedidia/clipboard.ReadAll(...)
        /home/waff/go/pkg/mod/github.com/zyedidia/clipboard@v1.0.3/clipboard.go:16
maunium.net/go/mauview.(*InputArea).Paste(0xc003042dc0)
        /home/waff/go/pkg/mod/maunium.net/go/mauview@v0.1.2/inputarea.go:933 +0x3a
maunium.net/go/mauview.(*InputArea).OnKeyEvent(0xc003042dc0, 0xf39ea0, 0xc0023b3540, 0xc003417c80)
        /home/waff/go/pkg/mod/maunium.net/go/mauview@v0.1.2/inputarea.go:1031 +0x22f
maunium.net/go/gomuks/ui.(*RoomView).OnKeyEvent(0xc003042f00, 0xf39ea0, 0xc0023b3540, 0x1375020)
        /home/waff/workspace/gomuks/ui/room-view.go:382 +0x172
maunium.net/go/mauview.(*Box).OnKeyEvent(0xc0001ce1c0, 0xf39ea0, 0xc0023b3540, 0xc003417d00)
        /home/waff/go/pkg/mod/maunium.net/go/mauview@v0.1.2/box.go:196 +0x5a
maunium.net/go/mauview.(*Flex).OnKeyEvent(...)
        /home/waff/go/pkg/mod/maunium.net/go/mauview@v0.1.2/flex.go:116
maunium.net/go/gomuks/ui.(*MainView).OnKeyEvent(0xc0004c33f0, 0xf39ea0, 0xc0023b3540, 0x0)
        /home/waff/workspace/gomuks/ui/view-main.go:204 +0x1e4
maunium.net/go/mauview.(*Application).Start(0xc000542240, 0x0, 0x0)
        /home/waff/go/pkg/mod/maunium.net/go/mauview@v0.1.2/application.go:155 +0x3b0
maunium.net/go/gomuks/ui.(*GomuksUI).Start(0xc00028a840, 0xd78038, 0xc00028a7b0)
        /home/waff/workspace/gomuks/ui/ui.go:73 +0x2f
main.(*Gomuks).Start(0xc00028a7b0)
        /home/waff/workspace/gomuks/gomuks.go:115 +0x11d
main.main()
        /home/waff/workspace/gomuks/main.go:83 +0x585

Process finished with exit code 2
apprehensions commented 1 year ago

damn bruh 2 years

jacks0n9 commented 1 year ago

man bruh, imagine if i just came in clutch and fixed this

jacks0n9 commented 3 weeks ago

yay!