pd0mz / go-aprs

Automatic Packet Reporting System implementation in Golang
MIT License
12 stars 7 forks source link

index out of range panic in parseMicEData #5

Open cceremuga opened 3 years ago

cceremuga commented 3 years ago

Here's the raw packet which triggered the panic:

VE2DJE-9>P_0_P?,VE2PCQ-3*,WIDE1*,KD2AYD-13*,KA2QYE-10*,WIDE2*:'{g+l >/Richard EN ROUTE

and here's a partial stacktrace

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

goroutine 19 [running]:
github.com/pd0mz/go-aprs.(*Packet).parseMicEData(0xc00008dc90, 0x19, 0xc00005e9
cf)
        /home/craig/go/pkg/mod/github.com/pd0mz/go-aprs@v0.0.0-20190904192146-3
4d6aa54791a/packet.go:303 +0x7d6
github.com/pd0mz/go-aprs.(*Packet).parse(0xc00008dc90, 0x2d, 0xc000068e70)
        /home/craig/go/pkg/mod/github.com/pd0mz/go-aprs@v0.0.0-20190904192146-3
4d6aa54791a/packet.go:266 +0x145
github.com/pd0mz/go-aprs.ParsePacket(0xc00005e9c6, 0x57, 0x0, 0x0, 0x0, 0x0, 0x
0, 0x0, 0x0, 0x0, ...)
        /home/craig/go/pkg/mod/github.com/pd0mz/go-aprs@v0.0.0-20190904192146-3
4d6aa54791a/packet.go:172 +0x385
cceremuga commented 3 years ago

Submitted a PR to resolve edge case in malformed packet.