]> git.eshelyaron.com Git - emacs.git/commitdiff
coding.c (detect_coding_iso_2022): Set coding->rejected correctly when an invalid...
authorKenichi Handa <handa@gnu.org>
Sun, 5 Oct 2014 08:17:15 +0000 (17:17 +0900)
committerKenichi Handa <handa@gnu.org>
Sun, 5 Oct 2014 08:17:15 +0000 (17:17 +0900)
src/ChangeLog
src/coding.c

index 8005b738d6dc0b81179056657a1aaca73c021278..c8779d37841df0262ac1149ae2cf602db6fc28e4 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-05  K. Handa  <handa@gnu.org>
+
+       * 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  <jan.h.d@swipnet.se>
 
        * gtkutil.c (create_menus): Only add tearoffs to empty menus.
index 0337c0df60e333d560acd48bc91d3612c906c316..02e59286dc8b88ac2de3b8e93e0091505527065a 100644 (file)
@@ -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;
                }