paypal / gatt

Gatt is a Go package for building Bluetooth Low Energy peripherals
BSD 3-Clause "New" or "Revised" License
1.12k stars 283 forks source link

Fix scanning ibeacon #106

Closed honeytrap15 closed 4 years ago

honeytrap15 commented 5 years ago

occurring runtime error on scanning ibeacon.

panic: runtime error: slice bounds out of range

goroutine 2787 [running]:
github.com/paypal/gatt.(*Advertisement).unmarshall(0xc000200c80, 0xc000204b43, 0x1c, 0x1c, 0xfb00000000000001, 0x4)
        /home/hiro/go/src/github.com/paypal/gatt/adv.go:99 +0xa5d
github.com/paypal/gatt.(*device).Init.func3(0xc000208e60)
        /home/hiro/go/src/github.com/paypal/gatt/device_linux.go:97 +0x6d
github.com/paypal/gatt/linux.(*HCI).handleAdvertisement(0xc0000be000, 0xc0001d9113, 0xc, 0xc)
        /home/hiro/go/src/github.com/paypal/gatt/linux/hci.go:262 +0x2bc
created by github.com/paypal/gatt/linux.(*HCI).handleLEMeta
        /home/hiro/go/src/github.com/paypal/gatt/linux/hci.go:359 +0x1c6

and output many logs like this.

2019/05/14 06:50:50 DATA: [ 9F FE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]
2019/05/14 06:50:51 DATA: [ 26 FE 0A C9 5C ]