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

Linux random numbers may not fill array completely #2

Closed
05nelsonm opened this issue Mar 2, 2023 · 3 comments
Closed

Linux random numbers may not fill array completely #2

05nelsonm opened this issue Mar 2, 2023 · 3 comments

Comments

@05nelsonm
Copy link

Current Linux implementation for PlatformRandom only checks for an error, but does not check if the number returned (the number of bytes retrieved from /dev/urandom) filled the ByteArray completely.

See fillCompletely

And fillCompletelyUsage

for pointers

@whyoleg
Copy link
Owner

whyoleg commented Mar 2, 2023

Thanks!

Will fix it
Do you have any idea on how to properly test it?

@05nelsonm
Copy link
Author

05nelsonm commented Mar 2, 2023

Do you have any idea on how to properly test it?

I just tested the fillCompletely extension function HERE and of course the actual implementation to ensure the ByteArray was actually filled with non-empty values within a certain threshold (b/c some indices will still remain empty) HERE. AFAIK, there's no real good way to get the result to return a specific value that would make the reading of /dev/urandom testable.

@whyoleg
Copy link
Owner

whyoleg commented Mar 13, 2023

fixed in 3e6e004

Real stress test was added in 6d596b5

Thx for findings!

@whyoleg whyoleg closed this as completed Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants