| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#undef NDEBUG |
| 20 |
#include "config.h" |
| 21 |
#include "common.h" |
| 22 |
|
| 23 |
#include <errno.h> |
| 24 |
#include <stdint.h> |
| 25 |
#include <stdio.h> |
| 26 |
#include <stdlib.h> |
| 27 |
|
| 28 |
#include <espeak-ng/espeak_ng.h> |
| 29 |
|
| 30 |
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); |
| 31 |
|
| 32 |
int main(int argc, char **argv) { |
| 33 |
int i; |
| 34 |
|
| 35 |
for (i = 1; i < argc; i++) { |
| 36 |
size_t filesize = GetFileLength(argv[i]); |
| 37 |
FILE *stream = fopen(argv[i], "r"); |
| 38 |
unsigned char *text = NULL; |
| 39 |
if (stream == NULL) { |
| 40 |
perror(argv[i]); |
| 41 |
exit(EXIT_FAILURE); |
| 42 |
} |
| 43 |
|
| 44 |
text = (unsigned char *) malloc(filesize + 1); |
| 45 |
if (text == NULL) { |
| 46 |
espeak_ng_PrintStatusCodeMessage(ENOMEM, stderr, NULL); |
| 47 |
exit(EXIT_FAILURE); |
| 48 |
} |
| 49 |
|
| 50 |
fread(text, 1, filesize, stream); |
| 51 |
text[filesize] = 0; |
| 52 |
fclose(stream); |
| 53 |
|
| 54 |
LLVMFuzzerTestOneInput(text, filesize); |
| 55 |
free(text); |
| 56 |
} |
| 57 |
|
| 58 |
return EXIT_SUCCESS; |
| 59 |
} |