Import Upstream version 2.72.4
This commit is contained in:
commit
4ef3ff9793
2003 changed files with 1332420 additions and 0 deletions
36
fuzzing/driver.c
Normal file
36
fuzzing/driver.c
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* Simpler gnu89 version of StandaloneFuzzTargetMain.c from LLVM */
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern int LLVMFuzzerTestOneInput (const unsigned char *data, size_t size);
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
FILE *f;
|
||||
long tell_result;
|
||||
size_t n_read, len;
|
||||
unsigned char *buf;
|
||||
|
||||
if (argc < 2)
|
||||
return 1;
|
||||
|
||||
f = fopen (argv[1], "r");
|
||||
assert (f);
|
||||
fseek (f, 0, SEEK_END);
|
||||
tell_result = ftell (f);
|
||||
assert (tell_result >= 0);
|
||||
len = (size_t) tell_result;
|
||||
fseek (f, 0, SEEK_SET);
|
||||
buf = (unsigned char*) malloc (len);
|
||||
n_read = fread (buf, 1, len, f);
|
||||
assert (n_read == len);
|
||||
LLVMFuzzerTestOneInput (buf, len);
|
||||
|
||||
free (buf);
|
||||
fclose (f);
|
||||
printf ("Done!\n");
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue