/src/liblouis/tests/fuzzing/table_fuzzer.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include <stdlib.h> |
2 | | #include <stdint.h> |
3 | | #include <stdio.h> |
4 | | #include "../../liblouis/liblouis.h" |
5 | | #include <filesystem> |
6 | | |
7 | | extern "C" int |
8 | | LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
9 | 1 | { |
10 | 1 | char new_file[256]; |
11 | 1 | sprintf(new_file, "/tmp/libfuzzer.uti"); |
12 | | |
13 | 1 | FILE *fp = fopen(new_file, "wb"); |
14 | 1 | if (!fp) |
15 | 0 | return 0; |
16 | 1 | fwrite(data, size, 1, fp); |
17 | 1 | fclose(fp); |
18 | | |
19 | 1 | char *table = "empty.ctb"; |
20 | 1 | lou_compileString(table, "include /tmp/libfuzzer.uti"); |
21 | | |
22 | 1 | lou_free(); |
23 | 1 | std::__fs::filesystem::remove_all("/tmp/libfuzzer.uti"); |
24 | | |
25 | 1 | return 0; |
26 | 1 | } |