diff options
author | Kenichi Handa <handa@gnu.org> | 2014-10-05 17:17:15 +0900 |
---|---|---|
committer | Kenichi Handa <handa@gnu.org> | 2014-10-05 17:17:15 +0900 |
commit | 1943141cf64f1935ba745c0dab5508d26adc6837 (patch) | |
tree | 04c9c4aa50f79199db331935d535d20d624a3baf /src/coding.c | |
parent | 1dad5c7b82fc9aa246e4efc15e26b6b89ef36fc6 (diff) | |
download | emacs-1943141cf64f1935ba745c0dab5508d26adc6837.tar.gz emacs-1943141cf64f1935ba745c0dab5508d26adc6837.tar.bz2 emacs-1943141cf64f1935ba745c0dab5508d26adc6837.zip |
coding.c (detect_coding_iso_2022): Set coding->rejected correctly when an invalid escape sequence is found (Bug#18610).
Diffstat (limited to 'src/coding.c')
-rw-r--r-- | src/coding.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c index 0337c0df60e..02e59286dc8 100644 --- a/src/coding.c +++ b/src/coding.c @@ -3073,8 +3073,13 @@ detect_coding_iso_2022 (struct coding_system *coding, ONE_MORE_BYTE (c1); if (c1 < ' ' || c1 >= 0x80 || (id = iso_charset_table[0][c >= ','][c1]) < 0) - /* Invalid designation sequence. Just ignore. */ - break; + { + /* Invalid designation sequence. Just ignore. */ + if (c1 >= 0x80) + rejected |= (CATEGORY_MASK_ISO_7BIT + | CATEGORY_MASK_ISO_7_ELSE); + break; + } } else if (c == '$') { @@ -3088,16 +3093,29 @@ detect_coding_iso_2022 (struct coding_system *coding, ONE_MORE_BYTE (c1); if (c1 < ' ' || c1 >= 0x80 || (id = iso_charset_table[1][c >= ','][c1]) < 0) - /* Invalid designation sequence. Just ignore. */ - break; + { + /* Invalid designation sequence. Just ignore. */ + if (c1 >= 0x80) + rejected |= (CATEGORY_MASK_ISO_7BIT + | CATEGORY_MASK_ISO_7_ELSE); + break; + } } else - /* Invalid designation sequence. Just ignore it. */ - break; + { + /* Invalid designation sequence. Just ignore it. */ + if (c >= 0x80) + rejected |= (CATEGORY_MASK_ISO_7BIT + | CATEGORY_MASK_ISO_7_ELSE); + break; + } } else { /* Invalid escape sequence. Just ignore it. */ + if (c >= 0x80) + rejected |= (CATEGORY_MASK_ISO_7BIT + | CATEGORY_MASK_ISO_7_ELSE); break; } |