eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fuzzrunner.c 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) 2018 Sascha Brawer
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write see:
  16. * <http://www.gnu.org/licenses/>.
  17. */
  18. #undef NDEBUG
  19. #include "config.h"
  20. #include "common.h"
  21. #include <errno.h>
  22. #include <stdint.h>
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <espeak-ng/espeak_ng.h>
  26. int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
  27. int main(int argc, char **argv) {
  28. int i;
  29. for (i = 1; i < argc; i++) {
  30. size_t filesize = GetFileLength(argv[i]);
  31. FILE *stream = fopen(argv[i], "r");
  32. unsigned char *text = NULL;
  33. if (stream == NULL) {
  34. perror(argv[i]);
  35. exit(EXIT_FAILURE);
  36. }
  37. text = (unsigned char *) malloc(filesize + 1);
  38. if (text == NULL) {
  39. espeak_ng_PrintStatusCodeMessage(ENOMEM, stderr, NULL);
  40. exit(EXIT_FAILURE);
  41. }
  42. fread(text, 1, filesize, stream);
  43. text[filesize] = 0;
  44. fclose(stream);
  45. LLVMFuzzerTestOneInput(text, filesize);
  46. free(text);
  47. }
  48. return EXIT_SUCCESS;
  49. }