1#include "fuzz.h"
2
3int
4LLVMFuzzerTestOneInput (const unsigned char *data, size_t size)
5{
6 unsigned char *nul_terminated_data = NULL;
7 GDateTime *dt = NULL;
8
9 fuzz_set_logging_func ();
10
11 /* ignore @size (the function doesn’t support it); ensure @data is nul-terminated */
12 nul_terminated_data = (unsigned char *) g_strndup (str: (const gchar *) data, n: size);
13 dt = g_date_time_new_from_iso8601 (text: (const gchar *) nul_terminated_data, NULL);
14 g_free (mem: nul_terminated_data);
15
16 if (dt != NULL)
17 {
18 gchar *text = g_date_time_format_iso8601 (datetime: dt);
19 g_free (mem: text);
20 }
21
22 g_clear_pointer (&dt, g_date_time_unref);
23
24 return 0;
25}
26

source code of gtk/subprojects/glib/fuzzing/fuzz_date_time_new_from_iso8601.c