comparison src/coding.c @ 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 4519d019f12e
children 858cdfcb7635
comparison
equal deleted inserted replaced
53006:36e0303c65f1 53007:36796e056954
1687 cmp_data->next = NULL; 1687 cmp_data->next = NULL;
1688 if (coding->cmp_data) 1688 if (coding->cmp_data)
1689 coding->cmp_data->next = cmp_data; 1689 coding->cmp_data->next = cmp_data;
1690 coding->cmp_data = cmp_data; 1690 coding->cmp_data = cmp_data;
1691 coding->cmp_data_start = 0; 1691 coding->cmp_data_start = 0;
1692 coding->composing = COMPOSITION_NO;
1692 } 1693 }
1693 1694
1694 /* Handle composition start sequence ESC 0, ESC 2, ESC 3, or ESC 4. 1695 /* Handle composition start sequence ESC 0, ESC 2, ESC 3, or ESC 4.
1695 ESC 0 : relative composition : ESC 0 CHAR ... ESC 1 1696 ESC 0 : relative composition : ESC 0 CHAR ... ESC 1
1696 ESC 2 : rulebase composition : ESC 2 CHAR RULE CHAR RULE ... CHAR ESC 1 1697 ESC 2 : rulebase composition : ESC 2 CHAR RULE CHAR RULE ... CHAR ESC 1
5438 { 5439 {
5439 int *data = cmp_data->data + i; 5440 int *data = cmp_data->data + i;
5440 enum composition_method method = (enum composition_method) data[3]; 5441 enum composition_method method = (enum composition_method) data[3];
5441 Lisp_Object components; 5442 Lisp_Object components;
5442 5443
5444 if (data[0] < 0 || i + data[0] > cmp_data->used)
5445 /* Invalid composition data. */
5446 break;
5447
5443 if (method == COMPOSITION_RELATIVE) 5448 if (method == COMPOSITION_RELATIVE)
5444 components = Qnil; 5449 components = Qnil;
5445 else 5450 else
5446 { 5451 {
5447 int len = data[0] - 4, j; 5452 int len = data[0] - 4, j;
5451 && len % 2 == 0) 5456 && len % 2 == 0)
5452 len --; 5457 len --;
5453 for (j = 0; j < len; j++) 5458 for (j = 0; j < len; j++)
5454 args[j] = make_number (data[4 + j]); 5459 args[j] = make_number (data[4 + j]);
5455 components = (method == COMPOSITION_WITH_ALTCHARS 5460 components = (method == COMPOSITION_WITH_ALTCHARS
5456 ? Fstring (len, args) : Fvector (len, args)); 5461 ? Fstring (make_number (len), args)
5462 : Fvector (make_number (len), args));
5457 } 5463 }
5458 compose_text (data[1], data[2], components, Qnil, obj); 5464 compose_text (data[1], data[2], components, Qnil, obj);
5459 } 5465 }
5460 cmp_data = cmp_data->next; 5466 cmp_data = cmp_data->next;
5461 } 5467 }