mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-30 17:36:16 +01:00
105f4a0f39
There’s no explicit guarantee that any of these functions are safe to use on untrusted data, but it does no harm to test them. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
20 lines
506 B
C
20 lines
506 B
C
#include "fuzz.h"
|
||
|
||
int
|
||
LLVMFuzzerTestOneInput (const unsigned char *data, size_t size)
|
||
{
|
||
unsigned char *nul_terminated_data = NULL;
|
||
GDate *date = g_date_new ();
|
||
|
||
fuzz_set_logging_func ();
|
||
|
||
/* ignore @size (g_date_set_parse() doesn’t support it); ensure @data is nul-terminated */
|
||
nul_terminated_data = (unsigned char *) g_strndup ((const gchar *) data, size);
|
||
g_date_set_parse (date, (const gchar *) nul_terminated_data);
|
||
g_free (nul_terminated_data);
|
||
|
||
g_date_free (date);
|
||
|
||
return 0;
|
||
}
|