aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2014-10-05 17:17:15 +0900
committerKenichi Handa2014-10-05 17:17:15 +0900
commit1943141cf64f1935ba745c0dab5508d26adc6837 (patch)
tree04c9c4aa50f79199db331935d535d20d624a3baf /src/coding.c
parent1dad5c7b82fc9aa246e4efc15e26b6b89ef36fc6 (diff)
downloademacs-1943141cf64f1935ba745c0dab5508d26adc6837.tar.gz
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.c30
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,
3073 ONE_MORE_BYTE (c1); 3073 ONE_MORE_BYTE (c1);
3074 if (c1 < ' ' || c1 >= 0x80 3074 if (c1 < ' ' || c1 >= 0x80
3075 || (id = iso_charset_table[0][c >= ','][c1]) < 0) 3075 || (id = iso_charset_table[0][c >= ','][c1]) < 0)
3076 /* Invalid designation sequence. Just ignore. */ 3076 {
3077 break; 3077 /* Invalid designation sequence. Just ignore. */
3078 if (c1 >= 0x80)
3079 rejected |= (CATEGORY_MASK_ISO_7BIT
3080 | CATEGORY_MASK_ISO_7_ELSE);
3081 break;
3082 }
3078 } 3083 }
3079 else if (c == '$') 3084 else if (c == '$')
3080 { 3085 {
@@ -3088,16 +3093,29 @@ detect_coding_iso_2022 (struct coding_system *coding,
3088 ONE_MORE_BYTE (c1); 3093 ONE_MORE_BYTE (c1);
3089 if (c1 < ' ' || c1 >= 0x80 3094 if (c1 < ' ' || c1 >= 0x80
3090 || (id = iso_charset_table[1][c >= ','][c1]) < 0) 3095 || (id = iso_charset_table[1][c >= ','][c1]) < 0)
3091 /* Invalid designation sequence. Just ignore. */ 3096 {
3092 break; 3097 /* Invalid designation sequence. Just ignore. */
3098 if (c1 >= 0x80)
3099 rejected |= (CATEGORY_MASK_ISO_7BIT
3100 | CATEGORY_MASK_ISO_7_ELSE);
3101 break;
3102 }
3093 } 3103 }
3094 else 3104 else
3095 /* Invalid designation sequence. Just ignore it. */ 3105 {
3096 break; 3106 /* Invalid designation sequence. Just ignore it. */
3107 if (c >= 0x80)
3108 rejected |= (CATEGORY_MASK_ISO_7BIT
3109 | CATEGORY_MASK_ISO_7_ELSE);
3110 break;
3111 }
3097 } 3112 }
3098 else 3113 else
3099 { 3114 {
3100 /* Invalid escape sequence. Just ignore it. */ 3115 /* Invalid escape sequence. Just ignore it. */
3116 if (c >= 0x80)
3117 rejected |= (CATEGORY_MASK_ISO_7BIT
3118 | CATEGORY_MASK_ISO_7_ELSE);
3101 break; 3119 break;
3102 } 3120 }
3103 3121