[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Dec 23 11:39:39 PST 2013


 src/hb-uniscribe.cc |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 3216e44feb7b97f44620b51e197425a80a41cdb7
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Dec 23 14:39:23 2013 -0500

    [uniscribe] Fix scratch-buffer accounting

diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index fcb1aa6..905ad5e 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -776,13 +776,14 @@ retry:
     }
   }
 
-  /* All the following types are sized in multiples of sizeof(int). */
-  unsigned int glyphs_size = scratch_size / ((sizeof (WORD) +
-					      sizeof (SCRIPT_GLYPHPROP) +
-					      sizeof (int) +
-					      sizeof (GOFFSET) +
-					      sizeof (uint32_t))
-					     / sizeof (int));
+  /* The -2 in the following is to compensate for possible
+   * alignment needed after the WORD array.  sizeof(WORD) == 2. */
+  unsigned int glyphs_size = (scratch_size * sizeof (int) - 2)
+			   / (sizeof (WORD) +
+			      sizeof (SCRIPT_GLYPHPROP) +
+			      sizeof (int) +
+			      sizeof (GOFFSET) +
+			      sizeof (uint32_t));
 
   ALLOCATE_ARRAY (WORD, glyphs, glyphs_size);
   ALLOCATE_ARRAY (SCRIPT_GLYPHPROP, glyph_props, glyphs_size);


More information about the HarfBuzz mailing list