File: table_fuzzer.cc

package info (click to toggle)
liblouis 3.36.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 86,248 kB
  • sloc: ansic: 37,162; makefile: 1,298; python: 772; lisp: 390; sh: 339; perl: 221; cpp: 21
file content (26 lines) | stat: -rw-r--r-- 527 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include "../../liblouis/liblouis.h"
#include <filesystem>

extern "C" int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
	char new_file[256];
	sprintf(new_file, "/tmp/libfuzzer.uti");

	FILE *fp = fopen(new_file, "wb");
	if (!fp)
		return 0;
	fwrite(data, size, 1, fp);
	fclose(fp);

	char *table = "empty.ctb";
	lou_compileString(table, "include /tmp/libfuzzer.uti");

	lou_free();
	std::__fs::filesystem::remove_all("/tmp/libfuzzer.uti");

	return 0;
}