wirepair / gcd

Unofficial implementation of the Google Chrome Remote Debugger in Go
MIT License
186 stars 31 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #25

Closed Paessler-Stefan closed 5 years ago

Paessler-Stefan commented 5 years ago

Hello @wirepair when building for 32bit system (x68-32) I get following exception.

panic: runtime error: invalid memory address or nil pointer dereference goroutine 1 [running]:

runtime/internal/atomic.Xadd64(0x135c00e4, 0x1, 0x0, 0x135c001c, 0xffffffff) C:/Go/src/runtime/internal/atomic/asm_386.s:102 +0xc

.../vendor/github.com/wirepair/gcd.(*ChromeTarget).GetId(0x135c0000, 0x1354c300, 0x45e178)

this seems to be related to an alignment issue with sendId in ChromeTarget struct which is used as atomic.AddInt64(&c.sendId, 1) moving the line declaring sendId int64 before Target *TargetInfo solves the issue, but the best way according to the sync/atomic documentation would be to move it to the front of the struct declaration.

wirepair commented 5 years ago

good find, i don't do 32bit builds as part of my tests so I didn't catch this. Could you provide a MR?

Paessler-Stefan commented 5 years ago

done :-) btw nice piece of software