Rizin
unix-like reverse engineering framework and cli tools
fuzz_main.c
Go to the documentation of this file.
1
#include "
zip_read_fuzzer.cc
"
2
#include <stdio.h>
3
#include <stdlib.h>
4
5
/* fuzz target entry point, works without libFuzzer */
6
7
int
8
main
(
int
argc,
char
**
argv
) {
9
FILE
*
f
;
10
char
*
buf
=
NULL
;
11
long
siz_buf;
12
13
if
(argc < 2) {
14
fprintf(stderr,
"no input file\n"
);
15
goto
err
;
16
}
17
18
f
= fopen(
argv
[1],
"rb"
);
19
if
(
f
==
NULL
) {
20
fprintf(stderr,
"error opening input file %s\n"
,
argv
[1]);
21
goto
err
;
22
}
23
24
fseek(
f
, 0,
SEEK_END
);
25
26
siz_buf = ftell(
f
);
27
rewind(
f
);
28
29
if
(siz_buf < 1) {
30
goto
err
;
31
}
32
33
buf
= (
char
*)
malloc
(siz_buf);
34
if
(
buf
==
NULL
) {
35
fprintf(stderr,
"malloc() failed\n"
);
36
goto
err
;
37
}
38
39
if
(fread(
buf
, siz_buf, 1,
f
) != 1) {
40
fprintf(stderr,
"fread() failed\n"
);
41
goto
err
;
42
}
43
44
(void)
LLVMFuzzerTestOneInput
((
uint8_t
*)
buf
, siz_buf);
45
46
err
:
47
free
(
buf
);
48
49
return
0;
50
}
err
static bool err
Definition:
armass.c:435
NULL
#define NULL
Definition:
cris-opc.c:27
LLVMFuzzerTestOneInput
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
Definition:
fuzz_disasm.c:221
main
int main(int argc, char **argv)
Definition:
fuzz_main.c:8
free
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition:
ht_inc.c:130
buf
voidpf void * buf
Definition:
ioapi.h:138
malloc
void * malloc(size_t size)
Definition:
malloc.c:123
argv
static static fork const void static count static fd const char const char static newpath char char argv
Definition:
sflib.h:40
benchmark.FILE
string FILE
Definition:
benchmark.py:21
uint8_t
unsigned char uint8_t
Definition:
sftypes.h:31
f
#define f(i)
Definition:
sha256.c:46
SEEK_END
#define SEEK_END
Definition:
zip.c:84
zip_read_fuzzer.cc
subprojects
libzip-1.9.2
regress
fuzz_main.c
Generated by
1.9.1