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

nsqd: check response message size is positive #267

Merged
merged 1 commit into from
Sep 26, 2019

Conversation

andyxning
Copy link
Member

This PR adds pre check for msg size before make a slice.

We have encountered a panic in make([]byte, msgSize) with panic: runtime error: makeslice: len out of range. We have bounded the max message size by 20MB. So, it seems that make function should not panic.

I have test that when make with a negative length, make will panic with panic: runtime error: makeslice: len out of range.

@andyxning andyxning force-pushed the pre_check_for_msg_size branch 3 times, most recently from af21f38 to 954e386 Compare September 22, 2019 12:04
@ploxiln
Copy link
Member

ploxiln commented Sep 25, 2019

This change looks obviously correct.

I think the commit title could be more specific - this is for reading a response message. Perhaps "check response message size is positive"

@andyxning andyxning force-pushed the pre_check_for_msg_size branch 4 times, most recently from 9f320ad to c4f433f Compare September 26, 2019 08:06
@andyxning andyxning force-pushed the pre_check_for_msg_size branch from c4f433f to 82f8d10 Compare September 26, 2019 08:28
@ploxiln ploxiln changed the title Pre check for msg size check response message size is positive Sep 26, 2019
- 1.11.x
- 1.12.x
- 1.13.x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is sort of throwing in an unrelated change ... but also seems fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ploxiln I bumped travis ci golang version to 1.13.x to resolve travis ci error when against 1.10.x. Since Golang 1.13 has been released, this bump should be fine. :)

@ploxiln ploxiln merged commit 0455293 into nsqio:master Sep 26, 2019
@andyxning andyxning deleted the pre_check_for_msg_size branch September 26, 2019 12:26
@mreiferson mreiferson added the bug label Jun 14, 2020
@mreiferson mreiferson changed the title check response message size is positive nsqd: check response message size is positive Jun 14, 2020
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 this pull request may close these issues.

3 participants