crypto-power / cryptopower

A cross-platform SPV (DCR, BTC & LTC) privacy wallet built with go.
ISC License
42 stars 25 forks source link

pasting an xpub into the xpub editor causes the app to crash #120

Open dreacot opened 11 months ago

dreacot commented 11 months ago

reproducible on mac os only

while attempting to add a watch only wallet, attempting to paste the xpub into the xpub editor using cltr+v causes the app to crash.

Screenshot from 2023-09-28 10-58-00

find the crash log below:

SIGILL: illegal instruction
PC=0x7ff80693f51f m=0 sigcode=1
signal arrived during cgo execution
instruction bytes: 0xf 0xb 0x48 0x8d 0x5 0xf1 0xe6 0x18 0x0 0x48 0x89 0x5 0x29 0x77 0x74 0x41

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x100f80410, 0xc002f2f220)
    /usr/local/go/src/runtime/cgocall.go:158 +0x5c fp=0xc002f2f1f8 sp=0xc002f2f1c0 pc=0x1000089bc
gioui.org/app._Cfunc_CFRelease(0x0)
    _cgo_gotypes.go:170 +0x45 fp=0xc002f2f220 sp=0xc002f2f1f8 pc=0x100c6c2e5
gioui.org/app.(*window).ReadClipboard.func1.1()
    /Users/apple/go/pkg/mod/gioui.org@v0.1.0/app/os_macos.go:300 +0x25 fp=0xc002f2f238 sp=0xc002f2f220 pc=0x100c70405
gioui.org/app.(*window).ReadClipboard(0xc002b0ee00)
    /Users/apple/go/pkg/mod/gioui.org@v0.1.0/app/os_macos.go:303 +0xa6 fp=0xc002f2f288 sp=0xc002f2f238 pc=0x100c70346
gioui.org/app.(*Window).processFrame(0xc002bbe000, {0x101a7b450, 0xc002b0ee00}, {0x9?, 0x0?, 0x0?})
    /Users/apple/go/pkg/mod/gioui.org@v0.1.0/app/window.go:319 +0x210 fp=0xc002f2f5e8 sp=0xc002f2f288 pc=0x100c65db0
gioui.org/app.(*Window).processEvent(0xc002bbe000, {0x101a7b450, 0xc002b0ee00}, {0x101a68540?, 0xc0034795c0?})
    /Users/apple/go/pkg/mod/gioui.org@v0.1.0/app/window.go:884 +0x1254 fp=0xc002f2fa18 sp=0xc002f2f5e8 pc=0x100c6a3d4
gioui.org/app.(*callbacks).Event(0xc002bbe4d0, {0x101a68540?, 0xc0034795c0?})
    /Users/apple/go/pkg/mod/gioui.org@v0.1.0/app/window.go:472 +0x13d fp=0xc002f2fb28 sp=0xc002f2fa18 pc=0x100c66dbd
gioui.org/app.(*window).draw(0xc002b0ee00)
    /Users/apple/go/pkg/mod/gioui.org@v0.1.0/app/os_macos.go:771 +0x2a5 fp=0xc002f2fc20 sp=0xc002f2fb28 pc=0x100c739c5
gioui.org/app.gio_onDraw(0xc0000061a0?)
    /Users/apple/go/pkg/mod/gioui.org@v0.1.0/app/os_macos.go:564 +0x37 fp=0xc002f2fc48 sp=0xc002f2fc20 pc=0x100c722d7
_cgoexp_4a1e2cc752df_gio_onDraw(0x7ff7bfefd250?)
    _cgo_gotypes.go:1017 +0x1c fp=0xc002f2fc60 sp=0xc002f2fc48 pc=0x100c74e5c
runtime.cgocallbackg1(0x100c74e40, 0xc002f2fe18?, 0x0)
    /usr/local/go/src/runtime/cgocall.go:316 +0x2b4 fp=0xc002f2fd30 sp=0xc002f2fc60 pc=0x100008ed4
runtime.cgocallbackg(0xc0000061a0?, 0x300000002?, 0xc0000061a0?)
    /usr/local/go/src/runtime/cgocall.go:235 +0x109 fp=0xc002f2fdc0 sp=0xc002f2fd30 pc=0x100008b69
runtime.cgocallbackg(0x100c74e40, 0x7ff7bfefc638, 0x0)
    <autogenerated>:1 +0x2f fp=0xc002f2fde8 sp=0xc002f2fdc0 pc=0x100072bef
runtime.cgocallback(0x1000089e5, 0x100f80f30, 0xc002abbe78)
    /usr/local/go/src/runtime/asm_amd64.s:994 +0xb4 fp=0xc002f2fe10 sp=0xc002f2fde8 pc=0x1000706f4
runtime.systemstack_switch()
    /usr/local/go/src/runtime/asm_amd64.s:459 fp=0xc002f2fe18 sp=0xc002f2fe10 pc=0x10006e6c0
runtime.cgocall(0x100f80f30, 0xc002f2fe78)
    /usr/local/go/src/runtime/cgocall.go:168 +0x85 fp=0xc002f```
ukane-philemon commented 11 months ago

I investigated the issues and found that attempting to paste an empty clipboard into ALL of our text inputs/editors (tried most of our text inputs) causes the app to crash. To reproduce: Clear your clipboard and try to paste it into any of the cryptopower text editors.

I think this is an upstream issue from this method: https://git.sr.ht/~eliasnaur/gio/tree/main/item/app/os_macos.go#L298.

dreacot commented 11 months ago

yes, i thought as much, as that error did not exist previously and there has been no change to the editor from our ends.

  1. we could try seeing if there is a newer version of gio and updating to that version.
  2. we could open an issue upstream if [1] doesn't work
ukane-philemon commented 11 months ago

yes, i thought as much, as that error did not exist previously and there has been no change to the editor from our ends.

  1. we could try seeing if there is a newer version of gio and updating to that version.
  2. we could open an issue upstream if [1] doesn't work

Did 1, but still issues persist. Do you want to go ahead with letting gio aware? Maybe they should give it a little priority?

dreacot commented 11 months ago

i'd submit an issue upstream

we need to double check the implementation from our side too

ukane-philemon commented 11 months ago

@dreacot, did you get to speak with the gio team about this?

dreacot commented 11 months ago

Thanks for following up, i haven't double checked to make sure the issue isn't from us, would do so tomorrow and revert

dreacot commented 11 months ago

yeah so this is only reproducible on macos, i have opened an issue upstream https://todo.sr.ht/~eliasnaur/gio/539

dreacot commented 11 months ago

@ukane-philemon are you still able to reproduce this? because i'm not, if you're able to please leave a detailed reproduction step here https://todo.sr.ht/~eliasnaur/gio/539#event-262453

i was also unable to reproduce using gioui.org/example/kitchen

ukane-philemon commented 11 months ago

Uhmm, I’ll take a look in the morning.

EDIT: Was unable to get to this but sure will before the weekend.

ukane-philemon commented 11 months ago

i was also unable to reproduce using gioui.org/example/kitchen

I've just reproduced with the kitchen example.

EDIT:

To reproduce: Clear your clipboard. It only panics when the clipboard is "really" empty. To do this on mac, open a finder window, click on the "Edit" tab on the system menu then click on the "Show Clipboard" button. You'll see the current content (if any) and the modal footer will say Clipboard contents: {content-type} e.g "text". A quick way to completely clear the clipboard is to restart your PC. This will clear the clipboard content entirely and you should see "Clipboard contents: none" in the clipboard footer when you view the clipboard again.

Avoid copying anything and just start the program then paste. Dropped a copy of this on source hunt.

ukane-philemon commented 11 months ago

We've got an upstream fix: https://git.sr.ht/~eliasnaur/gio/commit/ea58aac

I think we have to wait for the next release?

dreacot commented 11 months ago

yeah, that's fine, if it's urgent we can reference to that commit in our go mod