add fuzzers for chrono timepoint and localtime,gmtime#2469
Merged
vitaut merged 5 commits intofmtlib:masterfrom Aug 29, 2021
Merged
add fuzzers for chrono timepoint and localtime,gmtime#2469vitaut merged 5 commits intofmtlib:masterfrom
vitaut merged 5 commits intofmtlib:masterfrom
Conversation
vitaut
reviewed
Aug 26, 2021
vitaut
reviewed
Aug 26, 2021
test/fuzzing/chrono-timepoint.cc
Outdated
Comment on lines
+39
to
+42
| case 1: | ||
| // won't compile | ||
| // doit<std::chrono::steady_clock>(data,size); | ||
| 8000 break; |
Contributor
Author
There was a problem hiding this comment.
I get the below compile error, so I just assumed it was not supported.
../include/fmt/core.h:1592:3: error: static_assert failed due to requirement '!std::is_same<const fmt::v8::detail::unformattable &, const fmt::v8::detail::unformattable &>::value' "Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt"
static_assert(
^
../include/fmt/core.h:1718:23: note: in instantiation of function template specialization 'fmt::v8::detail::make_arg<true, fmt::v8::basic_format_context<fmt::v8::appender, char>, fmt::v8::detail::type::custom_type, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>> &, 0>' requested here
data_{detail::make_arg<
^
../include/fmt/core.h:1737:10: note: in instantiation of function template specialization 'fmt::v8::format_arg_store<fmt::v8::basic_format_context<fmt::v8::appender, char>, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>>::format_arg_store<std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>> &>' requested here
return {std::forward<Args>(args)...};
^
../include/fmt/core.h:2913:28: note: in instantiation of function template specialization 'fmt::v8::make_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char>, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>> &>' requested here
return vformat(fmt, fmt::make_format_args(args...));
^
../test/fuzzing/chrono-timepoint.cc:25:30: note: in instantiation of function template specialization 'fmt::v8::format<std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>> &>' requested here
std::string message = fmt::format(format_str.get(), timepoint);
^
../test/fuzzing/chrono-timepoint.cc:41:7: note: in instantiation of function template specialization 'doit<std::chrono::_V2::steady_clock>' requested here
doit<std::chrono::steady_clock>(data,size);
^
In file included from ../test/fuzzing/chrono-timepoint.cc:3:
In file included from ../include/fmt/chrono.h:17:
In file included from ../include/fmt/format.h:44:
../include/fmt/core.h:1202:14: error: call to deleted constructor of 'fmt::v8::detail::fallback_formatter<fmt::v8::detail::unformattable, char, void>'
auto f = Formatter();
^
../include/fmt/core.h:1189:21: note: in instantiation of function template specialization 'fmt::v8::detail::value<fmt::v8::basic_format_context<fmt::v8::appender, char>>::format_custom_arg<fmt::v8::detail::unformattable, fmt::v8::detail::fallback_formatter<fmt::v8::detail::unformattable, char, void>>' requested here
custom.format = format_custom_arg<
^
../test/fuzzing/chrono-timepoint.cc:25:30: note: in instantiation of function template specialization 'fmt::v8::format<std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>> &>' requested here
std::string message = fmt::format(format_str.get(), timepoint);
^
../test/fuzzing/chrono-timepoint.cc:41:7: note: in instantiation of function template specialization 'doit<std::chrono::_V2::steady_clock>' requested here
doit<std::chrono::steady_clock>(data,size);
^
../include/fmt/core.h:979:3: note: 'fallback_formatter' has been explicitly marked deleted here
fallback_formatter() = delete;
^
2 errors generated.
ninja: build stopped: subcommand failed.
vitaut
requested changes
Aug 28, 2021
mutating the first byte of the input now always results in picking on of the two paths. Before, two of the four possible outcomes resulted in doit() not being invoked.
5c47d1b to
a8f8e76
Compare
Contributor
Author
|
followed your requests, rebased and force pushed. |
vitaut
approved these changes
Aug 29, 2021
PoetaKodu
pushed a commit
to pacc-repo/fmt
that referenced
this pull request
Nov 11, 2021
* add fuzzers for chrono timepoint and localtime,gmtime * reorder cases to improve throughput mutating the first byte of the input now always results in picking on of the two paths. Before, two of the four possible outcomes resulted in doit() not being invoked. * drop the localtime fuzzer * inline aliases * only fuzz std::chrono::system_clock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds fuzzers for previously unfuzzed parts of the fmt api. I have run them locally without finding anything.