Skip to content

Fix infinite recursion in fill_bytes() #10213

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

Closed
wants to merge 1 commit into from
Closed

Fix infinite recursion in fill_bytes() #10213

wants to merge 1 commit into from

Conversation

telotortium
Copy link
Contributor

Fix the implementation of std::rand::Rng::fill_bytes() for
std::rand::reseeding::ReseedingRng to call the fill_bytes() method
of the underlying RNG rather than itself, which causes infinite
recursion.

Fixes #10202.

@telotortium
Copy link
Contributor Author

I get the following error when trying to build, but it doesn't seem related to my fix:

task '<unnamed>' failed at 'Couldn't commit in /tmp/SSbCQTUzC59sQnzLgit_local/mockgithub.com/catamorphism/test_pkg_version [git returned 1, output = # On branch master nothing to commit (working directory clean) , error = ]', /home/rmi1/misc/build/rust/src/librustpkg/tests.rs:153
test tests::test_package_request_version ... FAILED

@@ -201,4 +201,25 @@ mod test {
let string2 = r.gen_ascii_str(100);
assert_eq!(string1, string2);
}

// Fixes #10202 - based on example code for std::rand::Rng::fill_bytes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove this comment?

@huonw
Copy link
Member

huonw commented Nov 1, 2013

Can you squash the two commits into 1? (@mention me when you do so, Github doesn't notify when a PR gets updated.)

Fix the implementation of `std::rand::Rng::fill_bytes()` for
`std::rand::reseeding::ReseedingRng` to call the `fill_bytes()` method
of the underlying RNG rather than itself, which causes infinite
recursion.

Fixes #10202.
@telotortium
Copy link
Contributor Author

@huonw Should be fixed.

bors added a commit that referenced this pull request Nov 1, 2013
…w, r=huonw

Fix the implementation of `std::rand::Rng::fill_bytes()` for
`std::rand::reseeding::ReseedingRng` to call the `fill_bytes()` method
of the underlying RNG rather than itself, which causes infinite
recursion.

Fixes #10202.
@bors bors closed this Nov 1, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 27, 2023
Improve the changelog update documentation

- Make the clippy::version attribute instructions more prominent.
- Mention the beta-accepted label.

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog-doc/book/src/development/infrastructure/changelog_update.md)

r? `@xFrednet`

changelog: none
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

Successfully merging this pull request may close these issues.

std::rand::reseeding: infinite recursion in fill_bytes()
3 participants