Mercurial > emacs
changeset 89892:a2109a2c25d5
Sync to HEAD.
(emacs_mule_char): Check invalid code more regidly.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 12 Apr 2004 23:17:27 +0000 |
parents | 441b233fd039 |
children | 923821a85337 |
files | src/coding.c |
diffstat | 1 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/coding.c Mon Apr 12 13:35:01 2004 +0000 +++ b/src/coding.c Mon Apr 12 23:17:27 2004 +0000 @@ -1714,7 +1714,7 @@ if (! (charset = emacs_mule_charset[c])) goto invalid_code; ONE_MORE_BYTE (c); - if (c < 0) + if (c < 0xA0) goto invalid_code; code = c & 0x7F; break; @@ -1724,10 +1724,10 @@ || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) { ONE_MORE_BYTE (c); - if (c < 0 || ! (charset = emacs_mule_charset[c])) + if (c < 0xA0 || ! (charset = emacs_mule_charset[c])) goto invalid_code; ONE_MORE_BYTE (c); - if (c < 0) + if (c < 0xA0) goto invalid_code; code = c & 0x7F; } @@ -1736,11 +1736,11 @@ if (! (charset = emacs_mule_charset[c])) goto invalid_code; ONE_MORE_BYTE (c); - if (c < 0) + if (c < 0xA0) goto invalid_code; code = (c & 0x7F) << 8; ONE_MORE_BYTE (c); - if (c < 0) + if (c < 0xA0) goto invalid_code; code |= c & 0x7F; } @@ -1751,11 +1751,11 @@ if (c < 0 || ! (charset = emacs_mule_charset[c])) goto invalid_code; ONE_MORE_BYTE (c); - if (c < 0) + if (c < 0xA0) goto invalid_code; code = (c & 0x7F) << 8; ONE_MORE_BYTE (c); - if (c < 0) + if (c < 0xA0) goto invalid_code; code |= c & 0x7F; break; @@ -3232,7 +3232,10 @@ && src + 1 < src_end && src[0] == '%' && src[1] == '@') - break; + { + src += 2; + break; + } *p++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); } if (p + 3 > charbuf_end) @@ -5948,11 +5951,14 @@ len = -charbuf[0]; to = pos + charbuf[2]; + if (to <= pos) + return; method = (enum composition_method) (charbuf[3]); if (method == COMPOSITION_RELATIVE) components = Qnil; - else + else if (method >= COMPOSITION_WITH_RULE + && method <= COMPOSITION_WITH_RULE_ALTCHARS) { Lisp_Object args[MAX_COMPOSITION_COMPONENTS * 2 - 1]; int i; @@ -5960,10 +5966,16 @@ len -= 4; charbuf += 4; for (i = 0; i < len; i++) - args[i] = make_number (charbuf[i]); + { + args[i] = make_number (charbuf[i]); + if (args[i] < 0) + return; + } components = (method == COMPOSITION_WITH_ALTCHARS ? Fstring (len, args) : Fvector (len, args)); } + else + return; compose_text (pos, to, components, Qnil, coding->dst_object); } @@ -7021,7 +7033,9 @@ DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system, 1, 1, 0, doc: /* Check validity of CODING-SYSTEM. -If valid, return CODING-SYSTEM, else signal a `coding-system-error' error. */) +If valid, return CODING-SYSTEM, else signal a `coding-system-error' error. +It is valid if it is nil or a symbol defined as a coding system by the +function `define-coding-system'. */) (coding_system) Lisp_Object coding_system; { @@ -9574,3 +9588,6 @@ } #endif /* emacs */ + +/* arch-tag: 3a3a2b01-5ff6-4071-9afe-f5b808d9229d + (do not change this comment) */