[HarfBuzz] harfbuzz-ng: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Jan 18 18:34:49 PST 2012


 src/hb-ot-layout-gsub-table.hh       |    2 +-
 src/hb-ot-layout-gsubgpos-private.hh |   13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 03408ce73d003ed4e58e3f8472f9445e72b86bee
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jan 18 21:28:34 2012 -0500

    Fix more possible buffer overruns
    
    I have this function, but can't clean up it to my satisfaction.

diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index f1d03dc..13386c2 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -317,12 +317,14 @@ static inline bool apply_lookup (hb_apply_context_t *c,
    */
   for (unsigned int i = 0; i < count; /* NOP */)
   {
+    if (unlikely (c->buffer->idx == end))
+      return true;
     while (c->should_mark_skip_current_glyph ())
     {
-      if (unlikely (c->buffer->idx == end))
-	return true;
       /* No lookup applied for this index */
       c->buffer->next_glyph ();
+      if (unlikely (c->buffer->idx == end))
+	return true;
     }
 
     if (lookupCount && i == lookupRecord->sequenceIndex)
commit 7d479900cd11bc88148cd601ee43bc5492ce5843
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jan 18 21:19:32 2012 -0500

    Refactor the two remaining uses of _hb_ot_layout_skip_mark()

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 77f4400..f7ec3cc 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -392,7 +392,7 @@ struct Ligature
 
       for (unsigned int i = 1; i < count; i++)
       {
-	while (_hb_ot_layout_skip_mark (c->face, &c->buffer->info[c->buffer->idx], c->lookup_props, NULL))
+	while (c->should_mark_skip_current_glyph ())
 	{
 	  c->buffer->info[c->buffer->idx].lig_comp() = i;
 	  c->buffer->info[c->buffer->idx].lig_id() = lig_id;
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 211f0f4..f1d03dc 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -67,7 +67,6 @@ struct hb_apply_context_t
   unsigned int lookup_props;
   unsigned int property; /* propety of first glyph */
 
-
   struct mark_skipping_forward_iterator_t
   {
     inline mark_skipping_forward_iterator_t (hb_apply_context_t *c_,
@@ -146,6 +145,10 @@ struct hb_apply_context_t
     unsigned int num_items;
   };
 
+  inline bool should_mark_skip_current_glyph (void) const
+  {
+    return _hb_ot_layout_skip_mark (face, &buffer->info[buffer->idx], lookup_props, NULL);
+  }
 
 
 
@@ -314,7 +317,7 @@ static inline bool apply_lookup (hb_apply_context_t *c,
    */
   for (unsigned int i = 0; i < count; /* NOP */)
   {
-    while (_hb_ot_layout_skip_mark (c->face, &c->buffer->info[c->buffer->idx], c->lookup_props, NULL))
+    while (c->should_mark_skip_current_glyph ())
     {
       if (unlikely (c->buffer->idx == end))
 	return true;



More information about the HarfBuzz mailing list