sipcapture / heplify

Portable and Lightweight HEP Capture Agent for HOMER
https://sipcapture.org
GNU Affero General Public License v3.0
185 stars 65 forks source link

crash in parseNG() #149

Closed arkadiam closed 4 years ago

arkadiam commented 4 years ago

panic: runtime error: slice bounds out of range [:14] with capacity 4

goroutine 1 [running]:
github.com/sipcapture/heplify/decoder.parseNG(0xc0063c3ffc, 0x4, 0x4, 0x13, 0xc0063d89a8, 0x13, 0x0, 0x0)
        /home/sc/build/homer/heplify/decoder/util.go:239 +0xacb
github.com/sipcapture/heplify/decoder.parseNG(0xc0063c3ffc, 0x4, 0x4, 0xc0063da540, 0x7, 0x0, 0x0, 0x1)
        /home/sc/build/homer/heplify/decoder/util.go:205 +0x771
github.com/sipcapture/heplify/decoder.parseNG(0xc0063c3fc3, 0x3d, 0x3d, 0x82bb80, 0xc0063da540, 0x9, 0x0, 0x0)
        /home/sc/build/homer/heplify/decoder/util.go:182 +0x12f
github.com/sipcapture/heplify/decoder.parseNG(0xc0063c3fc2, 0x3e, 0x3e, 0x0, 0x1, 0xc0055ace00, 0x0, 0x1)
        /home/sc/build/homer/heplify/decoder/util.go:217 +0x836
github.com/sipcapture/heplify/decoder.parseNG(0xc0063c3f8e, 0x72, 0x72, 0x82bb80, 0xc0063cfbe0, 0x8, 0x0, 0x0)
        /home/sc/build/homer/heplify/decoder/util.go:182 +0x12f
github.com/sipcapture/heplify/decoder.parseNG(0xc0063c3ca2, 0x35e, 0x35e, 0x82bb80, 0xc0063cfb20, 0xd, 0x0, 0x0)
        /home/sc/build/homer/heplify/decoder/util.go:217 +0x836
github.com/sipcapture/heplify/decoder.parseNG(0xc0063c3c4b, 0x3b5, 0x3b5, 0x82bb80, 0xc0063ce940, 0x6, 0x0, 0x0)
        /home/sc/build/homer/heplify/decoder/util.go:217 +0x836
github.com/sipcapture/heplify/decoder.parseNG(0xc0063c364a, 0x9b6, 0x9b6, 0xc002e35407, 0x1, 0x1, 0xc, 0x80010000000000)
        /home/sc/build/homer/heplify/decoder/util.go:217 +0x836
github.com/sipcapture/heplify/decoder.unmarshalNG(0xc0063c202a, 0x1fd6, 0x1fd6, 0xa7, 0x209600e35470, 0x2000, 0x8, 0x7f49aa05aa20, 0x1, 0x203001)
        /home/sc/build/homer/heplify/decoder/util.go:137 +0x12c
github.com/sipcapture/heplify/decoder.correlateNG(0xc0063c202a, 0x1fd6, 0x1fd6, 0x8d9114, 0x7, 0xc002e356a0, 0x1, 0x1, 0x0)
        /home/sc/build/homer/heplify/decoder/correlator.go:190 +0x5d
github.com/sipcapture/heplify/decoder.(*Decoder).processTransport(0xc0000af220, 0xe991b0, 0xe9a040, 0xe9a460, 0x1, 0x4, 0x4, 0x100007f, 0x0, 0x100007f, ...)
        /home/sc/build/homer/heplify/decoder/decoder.go:330 +0x90b
github.com/sipcapture/heplify/decoder.(*Decoder).Process(0xc0000af220, 0xc0063c2000, 0x2000, 0x2000, 0xc0063b0b40)
        /home/sc/build/homer/heplify/decoder/decoder.go:226 +0x1068
github.com/sipcapture/heplify/sniffer.(*MainWorker).OnPacket(0xc000086c00, 0xc0063c2000, 0x2000, 0x2000, 0xc0063b0b40)
        /home/sc/build/homer/heplify/sniffer/sniffer.go:72 +0x57
github.com/sipcapture/heplify/sniffer.(*SnifferSetup).Run(0xc0000b68f0, 0x0, 0xc00014ec00)
        /home/sc/build/homer/heplify/sniffer/sniffer.go:308 +0x570
main.main()
        /home/sc/build/homer/heplify/main.go:110 +0xf9
negbie commented 4 years ago

Hi, oh this is a leftover to decode the rtpengine ng control protocol which is based on the bencode standard and shouldn't be public because the usecase is too specific. I removed it in the latest commit.

negbie commented 4 years ago

Checkout latest release https://github.com/sipcapture/heplify/releases