commit | 5f17dbc3025093308d2191a4abd2eec24db35c0e | [log] [tgz] |
---|---|---|
author | Behdad Esfahbod <behdad@behdad.org> | Fri Sep 07 10:24:22 2018 -0400 |
committer | Behdad Esfahbod <behdad@behdad.org> | Fri Sep 07 10:24:22 2018 -0400 |
tree | a841ceefe549bb1d263bf5e6d28b8c506bfe01e8 | |
parent | 21bf147054f6b5bd1c430c0e02a8c4058ed229a1 [diff] |
[subset] Fix div-by-zero
diff --git a/src/hb-subset.cc b/src/hb-subset.cc index adc7c51..2bed358 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc
@@ -51,6 +51,9 @@ unsigned int src_glyphs = plan->source->get_num_glyphs (); unsigned int dst_glyphs = plan->glyphset->get_population (); + if (unlikely (!src_glyphs)) + return 512 + table_len; + return 512 + (unsigned int) (table_len * sqrt ((double) dst_glyphs / src_glyphs)); }