Skip to content

Commit

Permalink
Only fuzz 64 bit ldbls for now since ryu seems to have it's own issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Apr 19, 2024
1 parent 9f78b66 commit 6d1d77e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fuzzing/fuzz_to_chars_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,20 @@ extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data, std::size_t size
boost::charconv::from_chars(c_data, c_data + size, val, format);
boost::charconv::to_chars(buffer, buffer + sizeof(buffer), val, format);

#if BOOST_CHARCONV_LDBL_BITS == 64
long double ld_val {};
boost::charconv::from_chars(c_data, c_data + size, ld_val, format);
boost::charconv::to_chars(buffer, buffer + sizeof(buffer), ld_val, format);
#endif

// Also try with precisions
for (int precision = -1; precision < 10; ++precision)
{
boost::charconv::to_chars(buffer, buffer + sizeof(buffer), f_val, format, precision);
boost::charconv::to_chars(buffer, buffer + sizeof(buffer), val, format, precision);
#if BOOST_CHARCONV_LDBL_BITS == 64
boost::charconv::to_chars(buffer, buffer + sizeof(buffer), ld_val, format, precision);
#endif
}
}
}
Expand Down

0 comments on commit 6d1d77e

Please sign in to comment.