# HG changeset patch # User Kenichi Handa # Date 909561133 0 # Node ID 6eb3e346d1fdc29b8760a968279f52e574833235 # Parent 18c5f58b70b55f139d3cb848a63c82b577fe27fe (DECODE_CHARACTER_ASCII): Check validity of inserted code. (DECODE_CHARACTER_DIMENSION1): Likewise. (DECODE_CHARACTER_DIMENSION2): Likewise. (decode_coding_sjis_big5): Check the 2nd byte of SJIS correctly. diff -r 18c5f58b70b5 -r 6eb3e346d1fd src/coding.c --- a/src/coding.c Wed Oct 28 05:48:12 1998 +0000 +++ b/src/coding.c Wed Oct 28 07:52:13 1998 +0000 @@ -219,11 +219,15 @@ { \ *dst++ = 0xA0, *dst++ = (c) | 0x80; \ coding->composed_chars++; \ + if (((c) | 0x80) < 0xA0) \ + coding->fake_multibyte = 1; \ } \ else \ { \ *dst++ = (c); \ coding->produced_char++; \ + if ((c) >= 0x80) \ + coding->fake_multibyte = 1; \ } \ } while (0) @@ -246,6 +250,8 @@ if (leading_code = CHARSET_LEADING_CODE_EXT (charset)) \ *dst++ = leading_code; \ *dst++ = (c) | 0x80; \ + if (((c) | 0x80) < 0xA0) \ + coding->fake_multibyte = 1; \ } while (0) /* Decode one DIMENSION2 character whose charset is CHARSET and whose @@ -255,6 +261,8 @@ do { \ DECODE_CHARACTER_DIMENSION1 (charset, c1); \ *dst++ = (c2) | 0x80; \ + if (((c2) | 0x80) < 0xA0) \ + coding->fake_multibyte = 1; \ } while (0) @@ -2022,7 +2030,7 @@ ASCII 0x00 .. 0x7F KATAKANA-JISX0201 0xA0 .. 0xDF JISX0208 (1st byte) 0x80 .. 0x9F and 0xE0 .. 0xEF - (2nd byte) 0x40 .. 0xFF + (2nd byte) 0x40 .. 0x7E and 0x80 .. 0xFC ------------------------------- */ @@ -2275,7 +2283,7 @@ { /* SJIS -> JISX0208 */ ONE_MORE_BYTE (c2); - if (c2 >= 0x40) + if (c2 >= 0x40 && c2 != 0x7F && c2 <= 0xFC) { DECODE_SJIS (c1, c2, c3, c4); DECODE_SJIS_BIG5_CHARACTER (charset_jisx0208, c3, c4);