emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117558: Fix bug #18610 with crashes when visitin


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r117558: Fix bug #18610 with crashes when visiting files with ESC and 8-bit bytes.
Date: Wed, 08 Oct 2014 07:32:53 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117558
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18610
author: K. Handa <address@hidden>
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Wed 2014-10-08 10:30:57 +0300
message:
  Fix bug #18610 with crashes when visiting files with ESC and 8-bit bytes.
  
   src/coding.c (detect_coding_iso_2022): Set coding->rejected
   correctly when an invalid escape sequence is found.
  
   Backported from trunk.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/coding.c                   coding.c-20091113204419-o5vbwnq5f7feedwu-1077
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-10-03 03:46:53 +0000
+++ b/src/ChangeLog     2014-10-08 07:30:57 +0000
@@ -1,3 +1,8 @@
+2014-10-08  K. Handa  <address@hidden>
+
+       * coding.c (detect_coding_iso_2022): Set coding->rejected
+       correctly when an invalid escape sequence is found (Bug#18610).
+
 2014-10-03  Dmitry Antipov  <address@hidden>
 
        * font.c (font_list_entities): Do not add empty vector to font cache.

=== modified file 'src/coding.c'
--- a/src/coding.c      2014-08-06 17:37:22 +0000
+++ b/src/coding.c      2014-10-08 07:30:57 +0000
@@ -3078,8 +3078,13 @@
                  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 == '$')
                {
@@ -3093,16 +3098,29 @@
                      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;
                }
 
@@ -3153,7 +3171,7 @@
          if (inhibit_iso_escape_detection)
            break;
          single_shifting = 0;
-         rejected |= CATEGORY_MASK_ISO_7BIT;
+         rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_7_ELSE;
          if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
              & CODING_ISO_FLAG_SINGLE_SHIFT)
            {
@@ -3180,9 +3198,9 @@
              single_shifting = 0;
              break;
            }
+         rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_7_ELSE;
          if (c >= 0xA0)
            {
-             rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_7_ELSE;
              found |= CATEGORY_MASK_ISO_8_1;
              /* Check the length of succeeding codes of the range
                  0xA0..0FF.  If the byte length is even, we include


reply via email to

[Prev in Thread] Current Thread [Next in Thread]