More Oops! Fix fast-path with sub-type==0
authorBehdad Esfahbod <behdad@behdad.org>
Sat, 9 Jun 2012 07:11:22 +0000 (03:11 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 9 Jun 2012 07:11:22 +0000 (03:11 -0400)
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gsub-table.hh
util/shape-consumer.hh

index 48f0a9d..c8020d8 100644 (file)
@@ -1311,7 +1311,7 @@ struct PosLookupSubTable
   inline bool can_use_fast_path (unsigned int lookup_type) const
   {
     /* Fast path, for those that have coverage in the same place. */
-    return likely (lookup_type < Context) ||
+    return likely (lookup_type && lookup_type < Context) ||
           (hb_in_range<unsigned int> (lookup_type, Context, ChainContext) &&
            hb_in_range<unsigned int> (u.header.sub_format, 1, 2));
   }
index e62be98..f5f38cc 100644 (file)
@@ -970,7 +970,7 @@ struct SubstLookupSubTable
     /* Fast path, for those that have coverage in the same place.
      * Note that ReverseChainSingle can also go through this but
      * it's not worth the effort. */
-    return likely (lookup_type < Context) ||
+    return likely (lookup_type && lookup_type < Context) ||
           (hb_in_range<unsigned int> (lookup_type, Context, ChainContext) &&
            hb_in_range<unsigned int> (u.header.sub_format, 1, 2));
   }
index 220daa4..11e4cc3 100644 (file)
@@ -49,6 +49,7 @@ struct shape_consumer_t
   {
     output.new_line ();
 
+    for (unsigned int i = 0; i < 10000; i++) {
     shaper.populate_buffer (buffer, text, text_len);
     output.consume_text (buffer, text, text_len, shaper.utf8_clusters);
 
@@ -58,6 +59,7 @@ struct shape_consumer_t
       output.shape_failed (buffer, text, text_len, shaper.utf8_clusters);
       return;
     }
+    }
 
     output.consume_glyphs (buffer, text, text_len, shaper.utf8_clusters);
   }