Skip to content

Conversation

@mstoeckl
Copy link
Contributor

@mstoeckl mstoeckl commented Dec 2, 2025

  • Added a CHANGELOG.md entry

Summary

When m or n is a positive floating point value with 0.5 m = 0.0 (e.g. 1e-45 for f32, or 5e-324 for f64) the constructor of FisherF could panic in one of the unwrap() calls.

Motivation

This is one of the unusual-parameter panics that I found by fuzzing, and fixing it turned out to be simple. (There's only a few more simple panics from fuzzing, and I expect fixing them before tackling the much trickier Binomial and Hypergeometric samplers may make things easier. And I'm not in a hurry :-). )

Details

The workaround is to reject FisherF distributions with m or n almost zero instead of unwrapping. I expect that in practice people only use integral m and n.

These are too small to construct a ChiSquared distribution from.
Copy link
Member

@dhardy dhardy left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@dhardy dhardy merged commit fe2a875 into rust-random:master Dec 2, 2025
14 checks passed
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.

2 participants