rand: Fix OsRng::fill_bytes on Windows#31876
Merged
bors merged 1 commit intorust-lang:masterfrom Feb 27, 2016
Merged
Conversation
…indows CryptGenRandom takes a DWORD (u32) for the length so it only supports writing u32::MAX bytes at a time. Casting the length from a usize caused truncation meaning the whole buffer was not always filled.
3 tasks
Contributor
|
@bors r+ Look like a security bug cc @rust-lang/core |
Collaborator
|
📌 Commit ac3cc33 has been approved by |
Contributor
|
it is a security bug, but note that what really matters is the external crate, not this one. rust-random/rand#99 |
Collaborator
|
⌛ Testing commit ac3cc33 with merge 4236392... |
Collaborator
|
💔 Test failed - auto-mac-32-opt |
Member
|
@bors: retry On Fri, Feb 26, 2016 at 11:22 AM, bors notifications@github.com wrote:
|
bors
added a commit
that referenced
this pull request
Feb 26, 2016
CryptGenRandom takes a DWORD (u32) for the length so it only supports writing u32::MAX bytes at a time. Casting the length from a usize caused truncation meaning the whole buffer was not always filled. cc #31841 This is the same as rust-random/rand#99. I think it's a good idea to keep the implementations in sync. r? @alexcrichton
Collaborator
|
⌛ Testing commit ac3cc33 with merge 98a8a71... |
Collaborator
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.
CryptGenRandom takes a DWORD (u32) for the length so it only supports
writing u32::MAX bytes at a time.
Casting the length from a usize caused truncation meaning the whole
buffer was not always filled.
cc #31841
This is the same as rust-random/rand#99. I think it's a good idea to keep the implementations in sync.
r? @alexcrichton