|
|
|
@ -29,9 +29,7 @@ trySubset (hb_face_t *face, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < text_length; i++) |
|
|
|
|
{ |
|
|
|
|
hb_set_add (codepoints, text[i]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hb_face_t *result = hb_subset (face, input); |
|
|
|
|
{ |
|
|
|
@ -65,16 +63,16 @@ trySubset (hb_face_t *face, |
|
|
|
|
drop_hints, drop_layout, retain_gids); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) |
|
|
|
|
{ |
|
|
|
|
alloc_state = size; /* see src/failing-alloc.c */ |
|
|
|
|
|
|
|
|
|
hb_blob_t *blob = hb_blob_create ((const char *)data, size, |
|
|
|
|
hb_blob_t *blob = hb_blob_create ((const char *) data, size, |
|
|
|
|
HB_MEMORY_MODE_READONLY, nullptr, nullptr); |
|
|
|
|
hb_face_t *face = hb_face_create (blob, 0); |
|
|
|
|
|
|
|
|
|
/* Just test this API here quickly. */ |
|
|
|
|
hb_set_t *output = hb_set_create(); |
|
|
|
|
hb_set_t *output = hb_set_create (); |
|
|
|
|
hb_face_collect_unicodes (face, output); |
|
|
|
|
hb_set_destroy (output); |
|
|
|
|
|
|
|
|
@ -88,14 +86,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
|
|
|
|
trySubset (face, text, sizeof (text) / sizeof (hb_codepoint_t), flags); |
|
|
|
|
|
|
|
|
|
hb_codepoint_t text_from_data[16]; |
|
|
|
|
if (size > sizeof(text_from_data) + sizeof(flags)) { |
|
|
|
|
if (size > sizeof (text_from_data) + sizeof (flags)) { |
|
|
|
|
memcpy (text_from_data, |
|
|
|
|
data + size - sizeof(text_from_data), |
|
|
|
|
sizeof(text_from_data)); |
|
|
|
|
data + size - sizeof (text_from_data), |
|
|
|
|
sizeof (text_from_data)); |
|
|
|
|
|
|
|
|
|
memcpy (flags, |
|
|
|
|
data + size - sizeof(text_from_data) - sizeof(flags), |
|
|
|
|
sizeof(flags)); |
|
|
|
|
data + size - sizeof (text_from_data) - sizeof (flags), |
|
|
|
|
sizeof (flags)); |
|
|
|
|
unsigned int text_size = sizeof (text_from_data) / sizeof (hb_codepoint_t); |
|
|
|
|
|
|
|
|
|
trySubset (face, text_from_data, text_size, flags); |
|
|
|
|