Skip to content
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

aead.go painc #301

Closed
oneday-nobody opened this issue Dec 21, 2021 · 9 comments · Fixed by #302
Closed

aead.go painc #301

oneday-nobody opened this issue Dec 21, 2021 · 9 comments · Fixed by #302
Labels

Comments

@oneday-nobody
Copy link

github.com/nadoo/glider

line 91

panic: runtime error: slice bounds out of range [:26586] with capacity 16384

goroutine 355 [running]:
github.com/nadoo/glider/proxy/vmess.(*aeadReader).read(0xc000c7d200, {0xc00113e000, 0x10738cf, 0x4000})
	github.com/nadoo/glider/proxy/vmess/aead.go:91 +0x239
github.com/nadoo/glider/proxy/vmess.(*aeadReader).Read(0xc000c7d200, {0xc00153b000, 0x13e4698, 0xc0014b3a20})
	github.com/nadoo/glider/proxy/vmess/aead.go:114 +0x87
github.com/nadoo/glider/proxy/vmess.(*Conn).Read(0xc000a7e9c0, {0xc00153b000, 0x1000, 0x1000})
	github.com/nadoo/glider/proxy/vmess/client.go:355 +0x55f
bufio.(*Reader).fill(0xc001019d40)
	bufio/bufio.go:101 +0x103
bufio.(*Reader).ReadSlice(0xc001019d40, 0x10)
	bufio/bufio.go:360 +0x2f
bufio.(*Reader).collectFragments(0x10, 0xa0)
	bufio/bufio.go:435 +0x74
bufio.(*Reader).ReadString(0xa1058f8, 0xc0)
	bufio/bufio.go:483 +0x2b
github.com/nadoo/glider/rule.(*httpChecker).Check(0xc00003b400, {0x13e1fa0, 0xc00037ca80})
	github.com/nadoo/glider/rule/check.go:74 +0x295
github.com/nadoo/glider/rule.(*FwdrGroup).check(0xc0003e5800, 0xc00037ca80, {0x13dcf60, 0xc00003b400})
	github.com/nadoo/glider/rule/group.go:250 +0xe8
created by github.com/nadoo/glider/rule.(*FwdrGroup).Check
	github.com/nadoo/glider/rule/group.go:230 +0x6a5

@nadoo
Copy link
Owner

nadoo commented Dec 21, 2021

Thanks for your report! Do you use glider v0.15.1? If so, can you try v0.15.0 and see whether it still panics?

@oneday-nobody
Copy link
Author

hi,

The above error was found when I was building from the source code (master branch).

In the code
line 91 of https://github.com/nadoo/glider/blob/b502b129b7e7daca4422c8691bf7a53461a9f781/proxy/vmess/aead.go, before p = p[:size], the length of the variable p is may be smaller than the value of the variable size.

The v0.15.1 version I just downloaded also has the same problem.

Thank you

@oneday-nobody
Copy link
Author

This is the configuration file I use to reproduce this issues, may be can help for you.

https://github.com/oneday-nobody/glider-forward/blob/main/glider-forward.conf

@nadoo
Copy link
Owner

nadoo commented Dec 21, 2021

The v0.15.1 source code is the same as the mater branch. Can you try v0.15.0?

@oneday-nobody
Copy link
Author

v0.15.0 is good, no panic

@nadoo
Copy link
Owner

nadoo commented Dec 21, 2021

Hi @mzz2017 , maybe it's caused by #298 ?

@mzz2017
Copy link
Contributor

mzz2017 commented Dec 21, 2021

I think you may be using a substandard VMess server implementation.
According to the document, the max length of chunk is 16384.
Thus, glider should consider about the substandard thing. For example, read a chunk with variable buffer size and copy from the buffer to p in batch.

@mzz2017
Copy link
Contributor

mzz2017 commented Dec 21, 2021

Or maybe we should check the opt field in the server response, and reject the connection with different opt.

@nadoo
Copy link
Owner

nadoo commented Dec 23, 2021

Hi @mzz2017 , I tested with the official v2ray server, it always panic. -_-!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants