/src/jsoncons/fuzzers/fuzz_csv.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | #include <stdio.h> |
2 | | |
3 | | #include <jsoncons_ext/csv/csv.hpp> |
4 | | |
5 | | #include <jsoncons/json.hpp> |
6 | | #include <jsoncons/json_reader.hpp> |
7 | | |
8 | | using namespace jsoncons; |
9 | | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, std::size_t size) |
10 | 2.55k | { |
11 | 2.55k | std::string input(reinterpret_cast<const char*>(data), size); |
12 | 2.55k | json_decoder<ojson> decoder; |
13 | 2.55k | auto options = csv::csv_options{} |
14 | 2.55k | .assume_header(true) |
15 | 2.55k | .mapping_kind(csv::csv_mapping_kind::n_rows); |
16 | 2.55k | try { |
17 | 2.55k | csv::csv_string_reader reader1(input, decoder, options); |
18 | 2.55k | reader1.read(); |
19 | 2.55k | } |
20 | 2.55k | catch (jsoncons::ser_error e) {} |
21 | 2.55k | catch (jsoncons::json_runtime_error<std::runtime_error> e) {} |
22 | 2.55k | catch (json_runtime_error<std::invalid_argument> e3) {} |
23 | 2.55k | return 0; |
24 | 2.55k | } |