summaryrefslogtreecommitdiff
path: root/pango/mini-fribidi/fribidi.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2003-05-27 23:24:28 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-05-27 23:24:28 +0000
commitc1b68c76890cee59cf705d3e4f3a09d166728cd7 (patch)
treed196fc04938ab28aaf1644cbf68c342c5dc32c90 /pango/mini-fribidi/fribidi.c
parent93a41fbb72a6758f899e45f1740a1182a9edb705 (diff)
downloadpango-c1b68c76890cee59cf705d3e4f3a09d166728cd7.tar.gz
Limit the size of the buffers we alloca(). (#104238
Tue May 27 18:37:44 2003 Owen Taylor <otaylor@redhat.com> * pango/mini-fribidi/fribidi.c (fribidi_analyse_string): Limit the size of the buffers we alloca(). (#104238
Diffstat (limited to 'pango/mini-fribidi/fribidi.c')
-rw-r--r--pango/mini-fribidi/fribidi.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/pango/mini-fribidi/fribidi.c b/pango/mini-fribidi/fribidi.c
index e8c4c10f..27b5d9f8 100644
--- a/pango/mini-fribidi/fribidi.c
+++ b/pango/mini-fribidi/fribidi.c
@@ -586,12 +586,21 @@ fribidi_analyse_string ( /* input */
/* Determinate character types */
DBG (" Determine character types\n");
{
- FriBidiCharType* char_type = g_alloca (len*sizeof(FriBidiCharType));
+ FriBidiCharType* char_type;
+
+ if (len < 512)
+ char_type = g_alloca (len*sizeof(FriBidiCharType));
+ else
+ char_type = g_malloc (len*sizeof(FriBidiCharType));
+
for (i = 0; i < len; i++)
char_type[i] = _pango_fribidi_get_type (str[i]);
/* Run length encode the character types */
type_rl_list = run_length_encode_types (char_type, len);
+
+ if (len >= 512)
+ g_free (char_type);
}
DBG (" Determine character types, Done\n");