Skip to content

Commit

Permalink
Merge pull request #83 from rust-fuzz/char-range
Browse files Browse the repository at this point in the history
Correct CHAR_END
  • Loading branch information
Manishearth committed May 18, 2021
2 parents e156f31 + df940e1 commit fab54ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ impl_arbitrary_for_floats! {
impl<'a> Arbitrary<'a> for char {
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
use std::char;
const CHAR_END: u32 = 0x0001_1000;
// The highest unicode code point is 0x11_FFFF
const CHAR_END: u32 = 0x11_0000;
// The size of the surrogate blocks
const SURROGATES_START: u32 = 0xD800;
let mut c = <u32 as Arbitrary<'a>>::arbitrary(u)? % CHAR_END;
Expand Down

0 comments on commit fab54ed

Please sign in to comment.