[subset] fix failure to init instruction ranges values for an invalid glyph.
authorGarret Rieger <grieger@google.com>
Sat, 19 Jan 2019 00:41:08 +0000 (16:41 -0800)
committerGarret Rieger <grieger@google.com>
Tue, 29 Jan 2019 21:19:21 +0000 (13:19 -0800)
src/hb-subset-glyf.cc

index 7b4344b..51608c9 100644 (file)
@@ -132,7 +132,7 @@ _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf,
                    glyf.remove_padding (start_offset, &end_offset))))
     {
       DEBUG_MSG(SUBSET, nullptr, "Invalid gid %d", next_glyph);
-      continue;
+      start_offset = end_offset = 0;
     }
 
     bool is_zero_length = end_offset - start_offset < OT::glyf::GlyphHeader::static_size;
@@ -242,9 +242,9 @@ _write_glyf_and_loca_prime (const hb_subset_plan_t        *plan,
     if (glyf_prime_data_next + length > glyf_prime_data + glyf_prime_size)
     {
       DEBUG_MSG(SUBSET,
-                nullptr,
-                "WARNING: Attempted to write an out of bounds glyph entry for gid %d (length %d)",
-                i, length);
+                nullptr,
+                "WARNING: Attempted to write an out of bounds glyph entry for gid %d (length %d)",
+                i, length);
       return false;
     }