goreplay
goreplay copied to clipboard
slice bounds out of range
Hello, I got a problem here, trace as below:
2018/05/21 15:11:09 PANIC: pkg: runtime error: slice bounds out of range Addr: r| Source port: 52950 Dest port:80 Sequence:3914442526 Acknowledgment:1424114713 Header len:5 FIN:false Data size:536 Data: ****** goroutine 32 [running]: runtime/debug.Stack(0x0, 0x0, 0x0) /usr/local/go/src/runtime/debug/stack.go:24 +0x80 github.com/buger/goreplay/raw_socket_listener.(*Listener).processTCPPacket.func1(0xc822986630) /go/src/github.com/buger/goreplay/raw_socket_listener/listener.go:676 +0x75 panic(0xa58cc0, 0xc82000e0c0) /usr/local/go/src/runtime/panic.go:443 +0x4e9 github.com/buger/goreplay/proto.header(0xc825dce536, 0x218, 0x218, 0x10d99bc, 0x6, 0x6, 0x0, 0x0, 0x0, 0x210, ...) /go/src/github.com/buger/goreplay/proto/proto.go:158 +0x272 github.com/buger/goreplay/proto.DeleteHeader(0xc825dce536, 0x218, 0x218, 0x10d99bc, 0x6, 0x6, 0x0, 0x0, 0x0) /go/src/github.com/buger/goreplay/proto/proto.go:327 +0x8b github.com/buger/goreplay/raw_socket_listener.(*Listener).processTCPPacket(0xc820184000, 0xc822986630) /go/src/github.com/buger/goreplay/raw_socket_listener/listener.go:770 +0xd8b github.com/buger/goreplay/raw_socket_listener.(*Listener).listen(0xc820184000) /go/src/github.com/buger/goreplay/raw_socket_listener/listener.go:148 +0x1dd created by github.com/buger/goreplay/raw_socket_listener.NewListener /go/src/github.com/buger/goreplay/raw_socket_listener/listener.go:119 +0x3aa
I look into function header
in proto.go. I guess when IndexByte retrun -1 may case that error.
Thank you for your attention.
Version: 0.16.1
@GhostZCH
Maybe you provide more infomation about this issue?
Cmd 、env、package? Or reproduce this in master
branch code
Thx
Cmd: gor -input-raw :80 --http-allow-header "Host:^myou\.ok\.com$" --http-allow-method "GET" --output-http "https://myou.notok.com" -output-file-append --http-disallow-url "^/api/v1" --http-disallow-url "^/api/v2" --http-disallow-url "^/myou-update-api"
Env: CentOS Linux release 7.6.1810 (Core), Kernel: 3.10.0-957.21.3.el7.x86_64
Package: v1.3.0_RC5
Interface: eth0 . BPF Filter: ((tcp dst port 80) and (dst host 172.16.9.175))
Interface: any . BPF Filter: (tcp dst port 80)
Interface: lo . BPF Filter: ((tcp dst port 80) and (dst host 127.0.0.1))
Interface: usbmon1 . BPF Filter: (tcp dst port 80)
Interface: usbmon0 . BPF Filter: (tcp dst port 80)
Interface: nflog . BPF Filter: (tcp dst port 80)
Interface: nfqueue . BPF Filter: (tcp dst port 80)
2021/06/14 22:53:58 [PPID 1 and PID 2353594] Version:1.3.0
panic: runtime error: slice bounds out of range [251:250]
goroutine 5 [running]:
github.com/buger/goreplay/proto.header(0xc0079e0a80, 0x28e, 0x36e, 0xc000513df9, 0xe, 0xe, 0x0, 0x0, 0x0, 0xffffffffffffffff, ...)
/go/src/github.com/buger/goreplay/proto/proto.go:115 +0x41a
github.com/buger/goreplay/proto.Header(...)
/go/src/github.com/buger/goreplay/proto/proto.go:149
github.com/buger/goreplay/proto.HasFullPayload(0x1057a40, 0xc0078d8320, 0xc0078cc800, 0x1, 0x1, 0xc000513eb8)
/go/src/github.com/buger/goreplay/proto/proto.go:512 +0x48d
main.http1EndHint(0xc0078d8320, 0xc0079e2510)
/go/src/github.com/buger/goreplay/input_raw.go:235 +0x8b
github.com/buger/goreplay/tcp.(*MessageParser).addPacket(0xc0000af1a0, 0xc0078d8320, 0xc0079e2510)
/go/src/github.com/buger/goreplay/tcp/tcp_message.go:286 +0xcd
github.com/buger/goreplay/tcp.(*MessageParser).processPacket(0xc0000af1a0, 0xc0079e2510)
/go/src/github.com/buger/goreplay/tcp/tcp_message.go:273 +0x137
github.com/buger/goreplay/tcp.(*MessageParser).wait(0xc0000af1a0)
/go/src/github.com/buger/goreplay/tcp/tcp_message.go:228 +0x1d0
created by github.com/buger/goreplay/tcp.NewMessageParser
/go/src/github.com/buger/goreplay/tcp/tcp_message.go:211 +0x152
@jianhaiqing this is new! I wonder if you can stably replicate it (and if so maybe attach small pcap file?). Thanks!