harfbuzz-ng: Pre-allocate enough space for CoreText buffer

This fixes an assert in OS X 10.10 Yosemite, where the pre-
allocated buffer would be too small to hold 3 successive calls
to ALLOCATE_ARRAY.

Task-number: QTBUG-39504
Change-Id: I5a0ae36170636eb97ab21c5903b96674e2a99547
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
bb10
Gabriel de Dietrich 2014-06-17 15:37:31 +02:00 committed by Jani Heikkinen
parent 10ff9d5b6f
commit abcea1c5f0
1 changed files with 2 additions and 1 deletions

View File

@ -738,7 +738,8 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
if (num_glyphs == 0)
continue;
buffer->ensure (buffer->len + num_glyphs + (endWithPDF ? 1 : 0));
const long ensureCount = DIV_CEIL(sizeof(CGGlyph) + sizeof(CGPoint) + sizeof(CFIndex), sizeof(*scratch));
buffer->ensure (buffer->len + ensureCount * (num_glyphs + (endWithPDF ? 1 : 0)));
scratch = buffer->get_scratch_buffer (&scratch_size);