scroot / gopacket

Automatically exported from code.google.com/p/gopacket
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

runtime error: slice bounds out of range #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello! It's me again :)

I compiled (big win!) and run this code: 
https://gist.github.com/pavel-odintsov/b8e83c1575b7c5d81f0e

It works few seconds correctly:
Packet captured!
PACKET: 54 bytes, wire length 54 cap length 54 @ 2014-06-16 23:58:26.339531 
+0400 MSK
- Layer 1 (14 bytes) = Ethernet {Contents=[...] Payload=[...] 
SrcMAC=00:1b:21:b8:7f:52 DstMAC=28:c0:da:46:7e:94 EthernetType=IPv4 Length=0}
- Layer 2 (20 bytes) = IPv4 {Contents=[...] Payload=[...] Version=4 IHL=5 TOS=0 
Length=40 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=TCP Checksum=38040 
SrcIP=178.63.152.142 DstIP=186.2.161.103 Options=[] Padding=[]}
- Layer 3 (20 bytes) = TCP  {Contents=[...] Payload=[] SrcPort=21(ftp) 
DstPort=22(ssh) Seq=0 Ack=2226600473 DataOffset=5 FIN=false SYN=false RST=true 
PSH=false ACK=true URG=false ECE=false CWR=false NS=false Window=0 
Checksum=19101 Urgent=0 Options=[] Padding=[]}

But fail with stacktrace:
panic: runtime error: slice bounds out of range

goroutine 4 [running]:
runtime.panic(0x527040, 0x95ffaa)
    /usr/lib/golang/src/pkg/runtime/panic.c:266 +0xb6
code.google.com/p/gopacket/pfring.(*Ring).ReadPacketData(0xc21107a000, 
0xc211084a00, 0x80, 0x80, 0xecb314362, ...)
    /root/tests_pf_ring/src/code.google.com/p/gopacket/pfring/pfring.go:136 +0x166
code.google.com/p/gopacket.(*PacketSource).NextPacket(0xc21106f300, 
0xc21107b000, 0x7f8568ddcad0, 0xc211087240, 0x0)
    /root/tests_pf_ring/src/code.google.com/p/gopacket/packet.go:656 +0x3a
code.google.com/p/gopacket.(*PacketSource).packetsToChannel(0xc21106f300, 
0xc21107b000)
    /root/tests_pf_ring/src/code.google.com/p/gopacket/packet.go:672 +0x27
created by code.google.com/p/gopacket.(*PacketSource).Packets
    /root/tests_pf_ring/src/code.google.com/p/gopacket/packet.go:693 +0x53

goroutine 1 [chan receive]:
main.main()
    /root/tests_pf_ring/test.go:21 +0x21f

goroutine 3 [syscall]:
runtime.goexit()
    /usr/lib/golang/src/pkg/runtime/proc.c:1394

Could you help me with this bug?

Original issue reported on code.google.com by pavel.odintsov on 16 Jun 2014 at 8:03

GoogleCodeExporter commented 9 years ago
Hello!

Sorry about notification about me but do you have any news?

Original comment by pavel.odintsov on 23 Jun 2014 at 12:28

GoogleCodeExporter commented 9 years ago
Hey, Pavel,

Sorry for the late reply, I missed the initial creation of this bug.  Could you 
do me a favor and pull down the current master?  I don't think the bug is 
fixed, but I'm hoping the line numbers will match up better.

  --Graeme

Original comment by gconnell@google.com on 23 Jun 2014 at 3:42

GoogleCodeExporter commented 9 years ago
Actually, I think I've found/fixed the issue.

See 
https://code.google.com/p/gopacket/source/detail?r=35e689a6f395166300d5c71a1979c
c98d09e9981

Original comment by gconnell@google.com on 23 Jun 2014 at 3:52

GoogleCodeExporter commented 9 years ago
Thank you, Graeme! This bug walk away! BUg I found next and will report it in 
next issue, sorry :(

Original comment by pavel.odintsov on 23 Jun 2014 at 8:30