2018-03-13 00:08:16 +01:00
|
|
|
#include "hb-fuzzer.hh"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "hb-subset.h"
|
|
|
|
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|
|
|
{
|
|
|
|
hb_blob_t *blob = hb_blob_create ((const char *)data, size,
|
|
|
|
HB_MEMORY_MODE_READONLY, NULL, NULL);
|
|
|
|
hb_face_t *face = hb_face_create (blob, 0);
|
|
|
|
hb_subset_profile_t *profile = hb_subset_profile_create ();
|
2018-04-19 22:39:57 +02:00
|
|
|
|
2018-03-13 00:08:16 +01:00
|
|
|
hb_subset_input_t *input = hb_subset_input_create_or_fail ();
|
2018-04-19 22:39:57 +02:00
|
|
|
*hb_subset_input_drop_hints(input) = false;
|
2018-03-13 00:08:16 +01:00
|
|
|
hb_set_t *codepoints = hb_subset_input_unicode_set (input);
|
|
|
|
|
2018-04-19 22:39:57 +02:00
|
|
|
hb_subset_input_t *input_drop_hints = hb_subset_input_create_or_fail ();
|
|
|
|
*hb_subset_input_drop_hints(input_drop_hints) = true;
|
|
|
|
hb_set_t *codepoints_drop_hints = hb_subset_input_unicode_set (input);
|
|
|
|
|
2018-03-13 00:08:16 +01:00
|
|
|
const hb_codepoint_t text[] =
|
|
|
|
{
|
|
|
|
'A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z', '1', '2',
|
|
|
|
'3', '@', '_', '%', '&', ')', '*', '$', '!'
|
|
|
|
};
|
|
|
|
for (int i = 0; i < sizeof (text) / sizeof (hb_codepoint_t); i++)
|
|
|
|
{
|
|
|
|
hb_set_add (codepoints, text[i]);
|
2018-04-19 22:39:57 +02:00
|
|
|
hb_set_add (codepoints_drop_hints, text[i]);
|
2018-03-13 00:08:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
hb_face_t *result = hb_subset (face, profile, input);
|
2018-04-19 22:39:57 +02:00
|
|
|
hb_face_destroy (result);
|
2018-03-13 00:08:16 +01:00
|
|
|
|
2018-04-19 22:39:57 +02:00
|
|
|
result = hb_subset (face, profile, input_drop_hints);
|
2018-03-13 00:33:47 +01:00
|
|
|
hb_face_destroy (result);
|
2018-04-19 22:39:57 +02:00
|
|
|
|
2018-03-13 00:08:16 +01:00
|
|
|
hb_subset_input_destroy (input);
|
2018-04-19 22:39:57 +02:00
|
|
|
hb_subset_input_destroy (input_drop_hints);
|
2018-03-13 00:08:16 +01:00
|
|
|
hb_subset_profile_destroy (profile);
|
|
|
|
hb_face_destroy (face);
|
|
|
|
hb_blob_destroy (blob);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|