Debian Codegraph @

tests/fuzzing/table_fuzzer.cc

raw
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 {
10 char new_file[256];
11 sprintf(new_file, "/tmp/libfuzzer.uti");
12
13 FILE *fp = fopen(new_file, "wb");
14 if (!fp)
15 return 0;
16 fwrite(data, size, 1, fp);
17 fclose(fp);
18
19 char *table = "empty.ctb";
20 lou_compileString(table, "include /tmp/libfuzzer.uti");
21
22 lou_free();
23 std::__fs::filesystem::remove_all("/tmp/libfuzzer.uti");
24
25 return 0;
26 }