[subset] Fix fuzzer issue.

Fixes https://oss-fuzz.com/testcase-detail/5693568490012672. new_index should be set from new_index2 when the entry is present in the map.
pull/3662/head
Garret Rieger 3 years ago committed by Behdad Esfahbod
parent 4ba7980b8e
commit 311413f16b
  1. 3
      src/hb-ot-post-table-v2subset.hh
  2. BIN
      test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5693568490012672

@ -87,9 +87,10 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
unsigned new_index;
const unsigned *new_index2;
if (old_index <= 257) new_index = old_index;
else if (!old_new_index_map.has (old_index, &new_index2))
else if (old_new_index_map.has (old_index, &new_index2))
{
new_index = *new_index2;
} else {
hb_bytes_t s = _post.find_glyph_name (old_gid);
new_index = glyph_name_to_new_index.get (s);
if (new_index == (unsigned)-1)

Loading…
Cancel
Save