Bug 488840 – harfbuzz: protect against ligid overflow

2007-10-21  Behdad Esfahbod  <behdad@gnome.org>

        Bug 488840 – harfbuzz: protect against ligid overflow

        * pango/opentype/harfbuzz-buffer.c (_hb_buffer_allocate_ligid):
        Never return zero, even in case of overflow.

        * pango/opentype/harfbuzz-impl.h: Define dummy HB_LIKELY() and
        HB_UNLIKELY(), to be filled later.
This commit is contained in:
Behdad Esfahbod 2007-10-21 18:17:02 +00:00 committed by Behdad Esfahbod
parent 6b347138b5
commit 13b2b96384
2 changed files with 8 additions and 1 deletions

View File

@ -356,5 +356,9 @@ _hb_buffer_replace_output_glyph( HB_Buffer buffer,
HB_INTERNAL FT_UShort
_hb_buffer_allocate_ligid( HB_Buffer buffer )
{
return ++buffer->max_ligID;
buffer->max_ligID++;
if (HB_UNLIKELY (buffer->max_ligID == 0))
buffer->max_ligID++;
return buffer->max_ligID;
}

View File

@ -49,6 +49,9 @@ FT_BEGIN_HEADER
# define FT_UNUSED(arg) ((arg) = (arg))
#endif
#define HB_LIKELY(cond) (cond)
#define HB_UNLIKELY(cond) (cond)
#include "ftglue.h"
#define ARRAY_LEN(Array) ((int)(sizeof (Array) / sizeof (Array)[0]))