Bug 1295299 - Cherry-pick harfbuzz fix 44f7d6ecde9bf7427a05cbe73ed5d668b8a72b2a. r=jrmuizel
authorJonathan Kew <jkew@mozilla.com>
Wed, 22 Feb 2017 09:17:50 +0000
changeset 373253 37c22fd0475e9ecddb207d5eed729ab4a1945ad7
parent 373252 b593e365b72df20e16ae74994275cd228749e5e5
child 373254 f748a9e7e08367311302ccb16833f4a9417469e7
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1295299
milestone54.0a1
Bug 1295299 - Cherry-pick harfbuzz fix 44f7d6ecde9bf7427a05cbe73ed5d668b8a72b2a. r=jrmuizel
gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh
--- a/gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh
+++ b/gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh
@@ -954,17 +954,17 @@ static inline bool apply_lookup (hb_appl
 				 unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
 				 unsigned int lookupCount,
 				 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
 				 unsigned int match_length)
 {
   TRACE_APPLY (NULL);
 
   hb_buffer_t *buffer = c->buffer;
-  unsigned int end;
+  int end;
 
   /* All positions are distance from beginning of *output* buffer.
    * Adjust. */
   {
     unsigned int bl = buffer->backtrack_len ();
     end = bl + match_length;
 
     int delta = bl - buffer->idx;
@@ -993,18 +993,18 @@ static inline bool apply_lookup (hb_appl
     unsigned int new_len = buffer->backtrack_len () + buffer->lookahead_len ();
     int delta = new_len - orig_len;
 
     if (!delta)
         continue;
 
     /* Recursed lookup changed buffer len.  Adjust. */
 
-    end = int (end) + delta;
-    if (end <= match_positions[idx])
+    end += delta;
+    if (end <= int (match_positions[idx]))
     {
       /* End might end up being smaller than match_positions[idx] if the recursed
        * lookup ended up removing many items, more than we have had matched.
        * Just never rewind end back and get out of here.
        * https://bugs.chromium.org/p/chromium/issues/detail?id=659496 */
       end = match_positions[idx];
       /* There can't be any further changes. */
       break;