BUGFIX: don't allocate more memory than what can be read from io.Reader#42
Merged
johnweldon merged 1 commit intogo-asn1-ber:masterfrom Apr 22, 2024
Merged
Conversation
inteon
commented
Apr 10, 2024
| // make([]byte, length) can allocate up to MaxPacketLengthBytes which is | ||
| // currently 2 GB. This can cause memory related crashes when fuzzing in | ||
| // parallel or on memory constrained devices. | ||
| MaxPacketLengthBytes = 65536 |
Contributor
Author
There was a problem hiding this comment.
This PR fixes the issue described above.
…ength of the io.Reader, causing potential DOS due to unexpected high memory usage (max MaxPacketLengthBytes) Signed-off-by: Tim Ramlot <[email protected]>
6f0d3c6 to
e0b83e0
Compare
Contributor
Author
|
I replaced |
Contributor
Author
|
@johnweldon PTAL |
Contributor
Author
|
@johnweldon Thanks for merging the PR, can this be a 1.5.6 release? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Memory was allocated based on encoded length instead of the length of the io.Reader.
This makes it possible for an attacker to cause DOS due to unexpected high memory usage (max MaxPacketLengthBytes) with a reader is actually limited in length.