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.
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;
}
# 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]))