/src/tarantool/test/fuzz/xrow_decode_watch_fuzzer.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include "box/xrow.h" |
2 | | #include "box/iproto_constants.h" |
3 | | #include "fiber.h" |
4 | | #include "memory.h" |
5 | | |
6 | | void |
7 | 0 | cord_on_yield(void) {} |
8 | | |
9 | | __attribute__((constructor)) |
10 | | static void |
11 | | setup(void) |
12 | 2 | { |
13 | 2 | memory_init(); |
14 | 2 | fiber_init(fiber_c_invoke); |
15 | 2 | } |
16 | | |
17 | | __attribute__((destructor)) |
18 | | static void |
19 | | teardown(void) |
20 | 0 | { |
21 | 0 | fiber_free(); |
22 | 0 | memory_free(); |
23 | 0 | } |
24 | | |
25 | | int |
26 | | LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
27 | 5.54k | { |
28 | 5.54k | const char *d = (const char *)data; |
29 | 5.54k | const char *end = (const char *)data + size; |
30 | 5.54k | if (mp_check(&d, end) != 0) |
31 | 1.46k | return -1; |
32 | | |
33 | 4.08k | struct iovec body = {0}; |
34 | 4.08k | body.iov_base = (void *)data; |
35 | 4.08k | body.iov_len = size; |
36 | | |
37 | 4.08k | struct xrow_header row = {0}; |
38 | 4.08k | row.body[0] = body; |
39 | 4.08k | row.bodycnt = 1; |
40 | | |
41 | 4.08k | struct watch_request request = {0}; |
42 | 4.08k | xrow_decode_watch(&row, &request); |
43 | | |
44 | 4.08k | return 0; |
45 | 5.54k | } |