-
-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic runtime error: slice bounds out of range #305
Labels
Comments
Indeed, looks like it received some invalid data. Are you able to consistently reproduce this? |
@kelindar when i send an invalid data, just telnet 8080 and send a bad data. ➜ emitter git:(master) ✗ telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
10a00100044d51545404c2000a0028363010a00100044d51545404c2000a00283630
Connection closed by foreign host. and got above like panic 2020/03/02 22:09:27 [closing] panic recovered: runtime error: slice bounds out of range
goroutine 80 [running]:
runtime/debug.Stack(0xc0003aad38, 0x49e8be0, 0x5374e90)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
github.com/emitter-io/emitter/internal/broker.(*Conn).Close(0xc0002b6880, 0x0, 0x0)
/Users/lizhengqian/gopath/gocode/src/github.com/emitter-io/emitter/internal/broker/conn.go:301 +0x243
panic(0x49e8be0, 0x5374e90)
/usr/local/go/src/runtime/panic.go:522 +0x1b5
github.com/emitter-io/emitter/internal/network/mqtt.readString(...)
/Users/lizhengqian/gopath/gocode/src/github.com/emitter-io/emitter/internal/network/mqtt/mqtt.go:857
github.com/emitter-io/emitter/internal/network/mqtt.decodePublish(0xc0000407e0, 0x30, 0x30, 0x100, 0x30, 0x30)
/Users/lizhengqian/gopath/gocode/src/github.com/emitter-io/emitter/internal/network/mqtt/mqtt.go:687 +0x202
github.com/emitter-io/emitter/internal/network/mqtt.DecodePacket(0x4d24e40, 0xc0000c3560, 0x10000, 0x5389560, 0x0, 0x0, 0x5389560)
/Users/lizhengqian/gopath/gocode/src/github.com/emitter-io/emitter/internal/network/mqtt/mqtt.go:215 +0x3eb
github.com/emitter-io/emitter/internal/broker.(*Conn).Process(0xc0002b6880, 0x0, 0x0)
/Users/lizhengqian/gopath/gocode/src/github.com/emitter-io/emitter/internal/broker/conn.go:128 +0x19a
created by github.com/emitter-io/emitter/internal/broker.(*Service).onAcceptConn
/Users/lizhengqian/gopath/gocode/src/github.com/emitter-io/emitter/internal/broker/service.go:303 +0x6e it seemed we should give rdr as parameter to decodexxx, then using rdr.Read() to get data, any good advice? |
lzh2nix
added a commit
to lzh2nix/emitter
that referenced
this issue
Mar 5, 2020
Florimond
pushed a commit
that referenced
this issue
Sep 7, 2023
* use slice index instead of copy of 2 value in range * fix #305
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Emitter Server - Docker Image
emitter/server:latest
Digest:sha256:ebd92d6930447120d6746505bb35a434c7c311b26caf53baf31d2d2f5da65baa
This is probably a minor issue, since the panic is recovered and happens during a connection close.
The text was updated successfully, but these errors were encountered: