-
Notifications
You must be signed in to change notification settings - Fork 78
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
ReadSlice: limit the max length for slices before invoking make([]byte, length) #37
Comments
This was referenced Oct 6, 2017
odeke-em
added a commit
that referenced
this issue
Oct 6, 2017
Fixes #25 Fixes #37 Fixes tendermint/tendermint#722 Before attempting to allocate a buffer to hold decoded lengths, check that it doesn't exceed math.MaxInt32 ie (2^31) - 1. In the case of overflows, report ErrBinaryReadOverflow and don't attempt to read anything. This issue was found firstly by @mveytsman in #25 and then independently confirmed by go-fuzz in tendermint.
odeke-em
added a commit
that referenced
this issue
Oct 6, 2017
Fixes #25 Fixes #37 Fixes tendermint/tendermint#722 Before attempting to allocate a buffer to hold decoded lengths, check that it doesn't exceed math.MaxInt32 ie (2^31) - 1. In the case of overflows, report ErrBinaryReadOverflow and don't attempt to read anything. This issue was found firstly by @mveytsman in #25 and then independently confirmed by go-fuzz in tendermint.
odeke-em
added a commit
that referenced
this issue
Oct 6, 2017
Fixes #25 Fixes #37 Fixes tendermint/tendermint#722 Before attempting to allocate a buffer to hold decoded lengths, check that it doesn't exceed math.MaxInt32 ie (2^31) - 1. In the case of overflows, report ErrBinaryReadOverflow and don't attempt to read anything. This issue was found firstly by @mveytsman in #25 and then independently confirmed by go-fuzz in tendermint.
Fixed by #38. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just found with go-fuzz, we should check that the number of bytes in the slice doesn't overflow.
The offending code below is at
https://github.com/tendermint/go-wire/blob/5f88da3dbc1a72844e6dfaf274ce87f851d488eb/byteslice.go#L28
In the check right above, we should also perform the due diligence to ensure that we report
ErrBinaryReadOverflow
https://github.com/tendermint/go-wire/blob/5f88da3dbc1a72844e6dfaf274ce87f851d488eb/byteslice.go#L23-L26
Repro code:
which gives
where:
The text was updated successfully, but these errors were encountered: