diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-08-28 09:46:14 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-08-28 09:46:14 -0400 |
commit | 735e2efc3369d4ad28a1ab73352232e39f768e27 (patch) | |
tree | 3cd508152e953730b8ab921724dd1ef0ae64cc80 /pango | |
parent | d82431ec05b92cef903d02d47d8069a9427e96b9 (diff) | |
download | pango-735e2efc3369d4ad28a1ab73352232e39f768e27.tar.gz |
Fix stupid array growing bug
Diffstat (limited to 'pango')
-rw-r--r-- | pango/opentype/hb-ot-layout.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pango/opentype/hb-ot-layout.cc b/pango/opentype/hb-ot-layout.cc index c8d2d2c7..3b6b8dae 100644 --- a/pango/opentype/hb-ot-layout.cc +++ b/pango/opentype/hb-ot-layout.cc @@ -222,10 +222,13 @@ _hb_ot_layout_set_glyph_class (hb_face_t *face, /* XXX this is not threadsafe */ if (glyph >= len) { - int new_len; + unsigned int new_len; unsigned char *new_klasses; new_len = len == 0 ? 120 : 2 * len; + while (new_len <= glyph) + new_len *= 2; + if (new_len > 65536) new_len = 65536; new_klasses = (unsigned char *) realloc (layout->new_gdef.klasses, new_len * sizeof (unsigned char)); |