[cff] Try fixing Heap-buffer-overflow in CFF::Charset::collect_glyph_to_sid_map

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47790
diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh
index ce97182..4aa337f 100644
--- a/src/hb-ot-cff1-table.hh
+++ b/src/hb-ot-cff1-table.hh
@@ -406,6 +406,8 @@
   void collect_glyph_to_sid_map (hb_map_t *mapping, unsigned int num_glyphs) const
   {
     hb_codepoint_t gid = 1;
+    if (gid >= num_glyphs)
+      return;
     for (unsigned i = 0;; i++)
     {
       hb_codepoint_t sid = ranges[i].first;