Commit d9bbec90 authored by Tim Rühsen's avatar Tim Rühsen

ascii_8z_fuzzer: Add NULL input/output tests

parent ed7633d1
......@@ -55,10 +55,45 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
memcpy(domain, data, size);
domain[size] = 0;
if (size == 0) {
/*** test NULL input(output combinations ***/
if (idn2_to_ascii_8z(NULL, &out, 0) == IDN2_OK)
idn2_free(out);
idn2_to_ascii_8z(NULL, NULL, 0);
idn2_to_ascii_8z(domain, NULL, 0);
if (idn2_to_ascii_lz(NULL, &out, 0) == IDN2_OK)
idn2_free(out);
idn2_to_ascii_lz(NULL, NULL, 0);
idn2_to_ascii_lz(domain, NULL, 0);
{
uint32_t in32[1]={0};
char out8[1];
idn2_to_ascii_4i(NULL, 0, out8, 0);
idn2_to_ascii_4i(NULL, 0, NULL, 0);
idn2_to_ascii_4i(in32, 0, NULL, 0);
}
{
uint32_t in32[1]={0};
if (idn2_to_ascii_4i2(NULL, 0, &out, 0) == IDN2_OK)
idn2_free(out);
idn2_to_ascii_4i2(NULL, 0, NULL, 0);
idn2_to_ascii_4i2(in32, 0, NULL, 0);
if (idn2_to_ascii_4z(NULL, &out, 0) == IDN2_OK)
idn2_free(out);
idn2_to_ascii_4z(NULL, NULL, 0);
idn2_to_ascii_4z(in32, NULL, 0);
}
}
for (unsigned it = 0; it < sizeof(flags)/sizeof(flags[0]); it++) {
if (idn2_to_ascii_8z(domain, &out, flags[it]) == IDNA_SUCCESS)
if (idn2_to_ascii_8z(domain, &out, flags[it]) == IDN2_OK)
idn2_free(out);
if (idn2_to_ascii_lz(domain, &out, flags[it]) == IDNA_SUCCESS)
if (idn2_to_ascii_lz(domain, &out, flags[it]) == 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