Commit 80eb8aeb authored by Tim Rühsen's avatar Tim Rühsen

register_fuzzer: Add NULL input/output tests

parent d9bbec90
......@@ -46,7 +46,15 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
memcpy(ulabel, data, size);
ulabel[size] = 0;
if (idn2_register_ul(ulabel, NULL, &out, 0) == IDNA_SUCCESS)
if (size == 0) {
/*** test NULL input/output combinations ***/
if (idn2_register_ul(NULL, NULL, &out, 0) == IDN2_OK)
idn2_free(out);
idn2_register_ul(ulabel, NULL, NULL, 0);
}
if (idn2_register_ul(ulabel, NULL, &out, 0) == IDN2_OK)
idn2_free(out);
free(ulabel);
......@@ -59,9 +67,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
memcpy(alabel + 4, data, size);
alabel[size] = 0;
if (idn2_register_ul(NULL, alabel, &out, 0) == IDNA_SUCCESS)
if (idn2_register_ul(NULL, alabel, &out, 0) == IDN2_OK)
idn2_free(out);
/*** test NULL input/output combinations ***/
if (size == 0)
idn2_register_ul(NULL, alabel, NULL, 0);
free(alabel);
return 0;
......
......@@ -56,7 +56,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
domain[size] = 0;
if (size == 0) {
/*** test NULL input(output combinations ***/
/*** test NULL input/output combinations ***/
if (idn2_to_ascii_8z(NULL, &out, 0) == IDN2_OK)
idn2_free(out);
......
......@@ -60,7 +60,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
x = NULL;
}
/*** test NULL input(output combinations ***/
/*** test NULL input/output combinations ***/
if (idn2_to_unicode_lzlz(NULL, &out, 0) == IDN2_OK)
idn2_free(out);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment