diff --git a/.github/workflows/run_fuzzer.yml b/.github/workflows/run_fuzzer.yml index 2b014bbf3..37b17b950 100644 --- a/.github/workflows/run_fuzzer.yml +++ b/.github/workflows/run_fuzzer.yml @@ -60,7 +60,7 @@ jobs: buildtype: 'boost' path: 'head' toolset: clang-18 - cxxstd: 14 + cxxstd: 17 targets: libs/json/fuzzing//run - name: Pack the corpus working-directory: boost-root/libs/json/fuzzing/ diff --git a/fuzzing/fuzz_direct_parse.cpp b/fuzzing/fuzz_direct_parse.cpp index 31dc8bcfa..8c9ab7e33 100644 --- a/fuzzing/fuzz_direct_parse.cpp +++ b/fuzzing/fuzz_direct_parse.cpp @@ -7,16 +7,10 @@ // #include +#include #include #include -#ifndef BOOST_NO_CXX17_HDR_VARIANT -# include -# define IF_CXX17_HDR_VARIANT(...) __VA_ARGS__ -#else -# define IF_CXX17_HDR_VARIANT(...) -#endif // BOOST_NO_CXX17_HDR_VARIANT - #ifndef BOOST_NO_CXX17_HDR_OPTIONAL # include # define IF_CXX17_HDR_OPTIONAL(...) __VA_ARGS__ @@ -46,10 +40,7 @@ struct Object std::tuple t1; std::tuple, std::array, std::nullptr_t> t2; std::tuple, std::vector> t3; - -#ifndef BOOST_NO_CXX17_HDR_VARIANT - std::variant v; -#endif // BOOST_NO_CXX17_HDR_VARIANT + boost::variant2::variant v; #ifndef BOOST_NO_CXX17_HDR_OPTIONAL std::optional ob; @@ -61,8 +52,9 @@ struct Object }; BOOST_DESCRIBE_STRUCT(Object, (), - (b, i64, u64, f, d, s, v1, v2, v3, a1, a2, a3, m1, m2, m3, t1, t2, t3, - IF_CXX17_HDR_OPTIONAL(ob, oi, ou, od, os), IF_CXX17_HDR_OPTIONAL(v))) + (b, i64, u64, f, d, s, v1, v2, v3, a1, a2, a3, m1, m2, m3, t1, t2, t3, v, + IF_CXX17_HDR_OPTIONAL(ob, oi, ou, od, os))) + bool fuzz_direct_parse(string_view sv) diff --git a/fuzzing/old_crashes/direct_parse/valid_cxx14.json b/fuzzing/old_crashes/direct_parse/valid_cxx14.json index 5415b246f..30598a7c2 100644 --- a/fuzzing/old_crashes/direct_parse/valid_cxx14.json +++ b/fuzzing/old_crashes/direct_parse/valid_cxx14.json @@ -16,5 +16,6 @@ "m3": {"k": 0.42}, "t1": [true, 1, 2, 1.23, "s"], "t2": [["a", "b", "c"], [1.0, 0.1, 2.2], null], - "t3": [[], []] + "t3": [[], []], + "v": "text" }