1 #include "git-compat-util.h"
4 int LLVMFuzzerTestOneInput(const uint8_t *data
, size_t size
);
6 int LLVMFuzzerTestOneInput(const uint8_t *data
, size_t size
)
13 enum date_mode_type dmtype
;
18 * we use the first byte to fuzz dmtype and the
19 * second byte to fuzz local, then the next two
20 * bytes to fuzz tz offset. The remainder
21 * (at least one byte) is fed as input to
22 * approxidate_careful().
26 local
= !!(*data
++ & 0x10);
27 num
= *data
++ % DATE_UNIX
;
28 if (num
>= DATE_STRFTIME
)
30 dmtype
= (enum date_mode_type
)num
;
34 tz
= (tz
<< 8) | *data
++;
37 str
= xmemdupz(data
, size
);
39 ts
= approxidate_careful(str
, &num
);
42 dm
= date_mode_from_type(dmtype
);
44 show_date(ts
, (int)tz
, dm
);
46 date_mode_release(&dm
);