goreplay icon indicating copy to clipboard operation
goreplay copied to clipboard

runtime error: slice bounds out of range

Open gygelly opened this issue 11 years ago • 8 comments

running gor 10.1 (64bit binary download) I get the following on every request:

2015/09/29 17:08:28 PANIC: pkg: runtime error: slice bounds out of range /gopath/src/github.com/buger/gor/raw_socket_listener/listener.go:199 (0x5969ee)
/goroot/src/runtime/asm_amd64.s:401 (0x454395)
/goroot/src/runtime/panic.go:387 (0x42ba78)
/goroot/src/runtime/panic.go:18 (0x42ac5e)
/gopath/src/github.com/buger/gor/raw_socket_listener/listener.go:237 (0x59425e)
/gopath/src/github.com/buger/gor/raw_socket_listener/listener.go:100 (0x592b41)
/goroot/src/runtime/asm_amd64.s:2232 (0x4564b1)

running gor from master with this commit: commit 16c5b6f15b0adf70aa0dc2b3ff565a5d0eccd0d3 Merge: 2b52228 5cf8f7d Author: Leonid Bugaev [email protected] Date: Wed Sep 23 16:53:49 2015 +0300

Merge pull request #210 from buger/support-non-rfc-headers

Handle headers added by bad clients

I get

2015/09/29 17:11:51 PANIC: pkg: runtime error: slice bounds out of range Source port: 59886
Dest port:80
Sequence:4169281620
Acknowledgment:2974121836
Header len:5
Flag ns:false
Flag crw:false
Flag ece:false
Flag urg:false
Flag ack:false
Flag psh:false
Flag rst:false
Flag syn:false
Flag fin:false
Window size:0
Checksum:0
Data size:1
Data: /go/src/github.com/buger/gor/raw_socket_listener/listener.go:199 (0x5d1cd5)
        (*Listener).processTCPPacket.func1: log.Println("PANIC: pkg:", r, packet, string(debug.Stack()))
/usr/local/go/src/runtime/asm_amd64.s:437 (0x4732de)
        call32: CALLFN(·call32, 32)
/usr/local/go/src/runtime/panic.go:423 (0x443959)
        gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
/usr/local/go/src/runtime/panic.go:18 (0x441e99)
        panicslice: panic(sliceError)
/go/src/github.com/buger/gor/raw_socket_listener/tcp_message.go:95 (0x5d02db)
        (*TCPMessage).IsMultipart: m := payload[:4]
/go/src/github.com/buger/gor/raw_socket_listener/listener.go:262 (0x5ceffe)
        (*Listener).processTCPPacket: if !message.IsMultipart() {
/go/src/github.com/buger/gor/raw_socket_listener/listener.go:100 (0x5cd962)
        (*Listener).listen: t.processTCPPacket(packet)
/usr/local/go/src/runtime/asm_amd64.s:1696 (0x475601)
        goexit: BYTE    $0x90   // NOP

Environment: Ubuntu 14.04 go version go.1.5.1 linux/amd64 I'm running gor inside an lxc container (the host uses iptables to send all port 80 traffice to the container)

Thanks for your help, and let me know if I'm doing something I'm not supposed to.

gygelly avatar Sep 29 '15 22:09 gygelly

Forgot to mention, I'm running this command: gor --input-raw :80 --output-http "http://10.10.10.153"

gygelly avatar Sep 29 '15 22:09 gygelly

I had exactly the same problem. I've created a pull request with a fix for the problem. @gygelly , you are doing nothing wrong. It is just a small bug in packet parsing.

ironsmile avatar Sep 30 '15 08:09 ironsmile

I had the same problem, I fixed it by opening the file and making sure the file starts with legit request (sometimes replay files start with truncated requests and that was causing a problem).

nnadirashvili avatar Oct 24 '15 01:10 nnadirashvili

Similar issue here as well.

2015/10/29 00:32:05 PANIC: pkg: runtime error: slice bounds out of range /gopath/src/github.com/buger/gor/raw_socket_listener/listener.go:199 (0x5969ee)
/goroot/src/runtime/asm_amd64.s:401 (0x454395)
/goroot/src/runtime/panic.go:387 (0x42ba78)
/goroot/src/runtime/panic.go:18 (0x42ac5e)
/gopath/src/github.com/buger/gor/raw_socket_listener/listener.go:237 (0x59425e)
/gopath/src/github.com/buger/gor/raw_socket_listener/listener.go:100 (0x592b41)
/goroot/src/runtime/asm_amd64.s:2232 (0x4564b1)

Gor version: 0.10.1 x64 Ubuntu 14.04.2 LTS

srinath-imaginea avatar Oct 29 '15 00:10 srinath-imaginea

Here too (Gor 0.10.1 x64):

Version: 0.10.1
panic: runtime error: slice bounds out of range

goroutine 533 [running]:
main.payloadMeta(0xc208f5b8c0, 0x2a5, 0x2a5, 0x0, 0x0, 0x0)
        /gopath/src/github.com/buger/gor/protocol.go:70 +0x120
main.(*HTTPOutput).sendRequest(0xc20800a3c0, 0xc208df38f0, 0xc208f5b8c0, 0x2a5, 0x2a5)
        /gopath/src/github.com/buger/gor/output_http.go:186 +0x50
main.(*HTTPOutput).startWorker(0xc20800a3c0)
        /gopath/src/github.com/buger/gor/output_http.go:125 +0x1b9
created by main.(*HTTPOutput).workerMaster
        /gopath/src/github.com/buger/gor/output_http.go:100 +0x7e

pbsurf avatar Oct 29 '15 15:10 pbsurf

Maybe we should discard malformed or incomplete HTTP transactions recorded on a file?
I think that this behaviour should not appear on http based input or output.

jbianquetti avatar Nov 03 '15 07:11 jbianquetti

I get this error too, but the copy of request has finished ,

was it caused by the lost of package ? and gor could also not control this behaviour

SmallTownRiver avatar Jan 20 '16 13:01 SmallTownRiver

this has been fixed in master since #216 has been merged Thanks

salimane avatar Apr 24 '16 05:04 salimane