From: Kenichi Handa Date: Sun, 5 Oct 2014 08:17:15 +0000 (+0900) Subject: coding.c (detect_coding_iso_2022): Set coding->rejected correctly when an invalid... X-Git-Tag: emacs-25.0.90~2635^2~679^2~125 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1943141cf64f1935ba745c0dab5508d26adc6837;p=emacs.git coding.c (detect_coding_iso_2022): Set coding->rejected correctly when an invalid escape sequence is found (Bug#18610). --- diff --git a/src/ChangeLog b/src/ChangeLog index 8005b738d6d..c8779d37841 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-10-05 K. Handa + + * coding.c (detect_coding_iso_2022): Set coding->rejected + correctly when an invalid escape sequence is found (Bug#18610). + 2014-10-04 Jan Djärv * gtkutil.c (create_menus): Only add tearoffs to empty menus. 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; }