/src/rtpproxy/scripts/fuzz/fuzz_command_parser.c
Line | Count | Source |
1 | | #include <assert.h> |
2 | | #include <string.h> |
3 | | #include <stdlib.h> |
4 | | #include <stdio.h> |
5 | | |
6 | | #include "fuzz_standalone.h" |
7 | | #include "rfz_utils.h" |
8 | | #include "rfz_command.h" |
9 | | #include "rfz_chunk.h" |
10 | | |
11 | | int |
12 | | LLVMFuzzerInitialize(int *_argc, char ***_argv) |
13 | 2 | { |
14 | | |
15 | 2 | return RTPPInitialize(); |
16 | 2 | } |
17 | | |
18 | | int |
19 | | LLVMFuzzerTestOneInput(const char *data, size_t size) |
20 | 7.37k | { |
21 | 7.37k | struct rfz_chunk chunk = {.rem_size = size, .rem_data = data}; |
22 | | |
23 | 151k | do { |
24 | 151k | chunk = rfz_get_chunk(chunk.rem_data, chunk.rem_size); |
25 | 151k | ExecuteRTPPCommand(&gconf, chunk.data, chunk.size, 0); |
26 | 151k | } while (chunk.rem_size > 1); |
27 | 7.37k | assert(ExecuteRTPPCommand(&gconf, "X", 1, 0) == 0); |
28 | 7.37k | return (0); |
29 | 7.37k | } |