Skip to content

Commit

Permalink
fuzz: improve code coverage (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler92 authored Dec 28, 2024
1 parent 6d03ceb commit d4e2468
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
utf8proc_int32_t c = 0, c_prev = 0, state = 0;
utf8proc_option_t options;
utf8proc_ssize_t ret, bytes = 0;
utf8proc_uint8_t *str = NULL;
size_t len = strlen((const char*)data);

while(bytes != len)
Expand Down Expand Up @@ -80,5 +81,14 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
free(utf8proc_NFKC(data));
free(utf8proc_NFKC_Casefold(data));

utf8proc_map(data, len, &str, UTF8PROC_CHARBOUND | UTF8PROC_STRIPNA);
free(str);

utf8proc_map(data, len, &str, UTF8PROC_LUMP | UTF8PROC_NLF2LS | UTF8PROC_NLF2PS);
free(str);

utf8proc_map(data, len, &str, UTF8PROC_COMPOSE | UTF8PROC_STRIPMARK);
free(str);

return 0;
}

0 comments on commit d4e2468

Please sign in to comment.