2020-06-19 12:54:41 +02:00
|
|
|
|
#include "fuzz.h"
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
LLVMFuzzerTestOneInput (const unsigned char *data, size_t size)
|
|
|
|
|
{
|
2020-06-29 12:52:40 +02:00
|
|
|
|
unsigned char *nul_terminated_data = NULL;
|
2020-06-19 12:54:41 +02:00
|
|
|
|
GUri *uri = NULL;
|
|
|
|
|
gchar *uri_string = NULL;
|
|
|
|
|
const GUriFlags flags = G_URI_FLAGS_NONE;
|
|
|
|
|
|
|
|
|
|
fuzz_set_logging_func ();
|
|
|
|
|
|
2020-06-29 12:52:40 +02:00
|
|
|
|
/* ignore @size (g_uri_parse() doesn’t support it); ensure @data is nul-terminated */
|
|
|
|
|
nul_terminated_data = (unsigned char *) g_strndup ((const gchar *) data, size);
|
2020-06-30 12:08:05 +02:00
|
|
|
|
uri = g_uri_parse ((const gchar *) nul_terminated_data, flags, NULL);
|
2020-06-29 12:52:40 +02:00
|
|
|
|
g_free (nul_terminated_data);
|
|
|
|
|
|
2020-06-19 12:54:41 +02:00
|
|
|
|
if (uri == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
uri_string = g_uri_to_string (uri);
|
|
|
|
|
g_uri_unref (uri);
|
|
|
|
|
|
|
|
|
|
if (uri_string == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
g_free (uri_string);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|