]> git.lizzy.rs Git - rust.git/commit
rand: Fix filling buffers 4 GiB or larger with OsRng::fill_bytes on Windows
authorOliver Middleton <olliemail27@gmail.com>
Thu, 25 Feb 2016 01:35:41 +0000 (01:35 +0000)
committerOliver Middleton <olliemail27@gmail.com>
Thu, 25 Feb 2016 01:35:41 +0000 (01:35 +0000)
commitac3cc33fee5e0f576cc9f04f7df40cd5d968be43
tree41dbd37d5c3467ec4826487e3c4631412284938b
parent0ef8d426050318934d16d962325ec002eaf0c29d
rand: Fix filling buffers 4 GiB or larger with OsRng::fill_bytes on Windows

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.
src/libstd/sys/windows/rand.rs