changeset 53007:36796e056954

(coding_allocate_composition_data): Reset coding->composing to COMPOSITION_NO. (coding_restore_composition): Detect invalid composition data. Give Fstring and Fvector a Lispy integer, not C int.
author Kenichi Handa <handa@m17n.org>
date Fri, 07 Nov 2003 05:55:27 +0000
parents 36e0303c65f1
children 73b6a77c4213
files src/coding.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Fri Nov 07 04:17:52 2003 +0000
+++ b/src/coding.c	Fri Nov 07 05:55:27 2003 +0000
@@ -1689,6 +1689,7 @@
     coding->cmp_data->next = cmp_data;
   coding->cmp_data = cmp_data;
   coding->cmp_data_start = 0;
+  coding->composing = COMPOSITION_NO;
 }
 
 /* Handle composition start sequence ESC 0, ESC 2, ESC 3, or ESC 4.
@@ -5440,6 +5441,10 @@
 	  enum composition_method method = (enum composition_method) data[3];
 	  Lisp_Object components;
 
+	  if (data[0] < 0 || i + data[0] > cmp_data->used)
+	    /* Invalid composition data.  */
+	    break;
+
 	  if (method == COMPOSITION_RELATIVE)
 	    components = Qnil;
 	  else
@@ -5453,7 +5458,8 @@
 	      for (j = 0; j < len; j++)
 		args[j] = make_number (data[4 + j]);
 	      components = (method == COMPOSITION_WITH_ALTCHARS
-			    ? Fstring (len, args) : Fvector (len, args));
+			    ? Fstring (make_number (len), args)
+			    : Fvector (make_number (len), args));
 	    }
 	  compose_text (data[1], data[2], components, Qnil, obj);
 	}