From 3c97614598ecd0bbccb2c90a8e0e99f010952b76 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Thu, 19 Apr 2018 13:39:57 -0700 Subject: [PATCH] [subset] In subset fuzzer run through drop hints and keep hints pathways. --- test/fuzzing/hb-subset-fuzzer.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/fuzzing/hb-subset-fuzzer.cc b/test/fuzzing/hb-subset-fuzzer.cc index dfa836131..8bf6b4fad 100644 --- a/test/fuzzing/hb-subset-fuzzer.cc +++ b/test/fuzzing/hb-subset-fuzzer.cc @@ -12,10 +12,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 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 (); - // TODO(grieger): Loop through common profiles (hints, no hints, etc.) + hb_subset_input_t *input = hb_subset_input_create_or_fail (); + *hb_subset_input_drop_hints(input) = false; hb_set_t *codepoints = hb_subset_input_unicode_set (input); + 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); + const hb_codepoint_t text[] = { 'A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z', '1', '2', @@ -24,12 +29,17 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) for (int i = 0; i < sizeof (text) / sizeof (hb_codepoint_t); i++) { hb_set_add (codepoints, text[i]); + hb_set_add (codepoints_drop_hints, text[i]); } hb_face_t *result = hb_subset (face, profile, input); - hb_face_destroy (result); + + result = hb_subset (face, profile, input_drop_hints); + hb_face_destroy (result); + hb_subset_input_destroy (input); + hb_subset_input_destroy (input_drop_hints); hb_subset_profile_destroy (profile); hb_face_destroy (face); hb_blob_destroy (blob);