summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-10-21 18:17:02 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-10-21 18:17:02 +0000
commit12091072940c4cd649d0230f45937f65adbfce46 (patch)
treec9a168da44cb05469e2828a80541d27e32f7aad3 /pango
parent25bcdcfe76a640086527e029394bb61b03e7a8d6 (diff)
downloadpango-12091072940c4cd649d0230f45937f65adbfce46.tar.gz
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. svn path=/trunk/; revision=2453
Diffstat (limited to 'pango')
-rw-r--r--pango/opentype/harfbuzz-buffer.c6
-rw-r--r--pango/opentype/harfbuzz-impl.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/pango/opentype/harfbuzz-buffer.c b/pango/opentype/harfbuzz-buffer.c
index 8f9539a9..4b25a5f1 100644
--- a/pango/opentype/harfbuzz-buffer.c
+++ b/pango/opentype/harfbuzz-buffer.c
@@ -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;
}
diff --git a/pango/opentype/harfbuzz-impl.h b/pango/opentype/harfbuzz-impl.h
index 2215d2c4..dc89fa67 100644
--- a/pango/opentype/harfbuzz-impl.h
+++ b/pango/opentype/harfbuzz-impl.h
@@ -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]))