emacs-devel
[Top][All Lists]
Advanced

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

Change of octal prefix character crashes Emacs


From: Ehud Karni
Subject: Change of octal prefix character crashes Emacs
Date: Tue, 22 Feb 2005 00:49:30 +0200

Changing the octal prefix character by setting slot 2 of the
`standard-display-table' cause Emacs to crash when trying to
display a character that should be displayed in octal.

How to crash Emacs:
1. Add octal displayed characters, e.g. \221 \222 \223
2. Eval the following 2 lines:
   (setq standard-display-table (make-display-table))
   (set-display-table-slot standard-display-table 2 ?!)
3. If Emacs has not crashed yet, refresh the view by ^L.

The patch below fix this bug.

Ehud.


--- xdisp.c.~1.983.~    2005-02-21 11:21:45.000000000 +0200
+++ xdisp.c     2005-02-22 00:45:41.000000000 +0200
@@ -5084,11 +5084,12 @@
                 display.  Then, set IT->dpvec to these glyphs.  */
              GLYPH g;
              int ctl_len;
-             int face_id, lface_id;
+             int face_id, lface_id = 0 ;
              GLYPH escape_glyph;

              if (it->c < 128 && it->ctl_arrow_p)
                {
+                 g = '^';           /* default glyph for Control */
                  /* Set IT->ctl_chars[0] to the glyph for `^'.  */
                  if (it->dp
                      && INTEGERP (DISP_CTRL_GLYPH (it->dp))
@@ -5096,19 +5097,18 @@
                    {
                      g = XINT (DISP_CTRL_GLYPH (it->dp));
                      lface_id = FAST_GLYPH_FACE (g);
-                     if (lface_id)
-                       {
-                         g = FAST_GLYPH_CHAR (g);
-                         face_id = merge_faces (it->f, Qt, lface_id,
-                                                it->face_id);
-                       }
+                   }
+                 if (lface_id)
+                   {
+                      g = FAST_GLYPH_CHAR (g);
+                      face_id = merge_faces (it->f, Qt, lface_id,
+                                             it->face_id);
                    }
                  else
                    {
                      /* Merge the escape-glyph face into the current face.  */
                      face_id = merge_faces (it->f, Qescape_glyph, 0,
                                             it->face_id);
-                     g = '^';
                    }

                  XSETINT (it->ctl_chars[0], g);
@@ -5118,25 +5118,25 @@
                  goto display_control;
                }

+             escape_glyph = '\\';    /* default for Octal display */
              if (it->dp
                  && INTEGERP (DISP_ESCAPE_GLYPH (it->dp))
                  && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp))))
                {
                  escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp));
                  lface_id = FAST_GLYPH_FACE (escape_glyph);
-                 if (lface_id)
-                   {
-                     escape_glyph = FAST_GLYPH_CHAR (escape_glyph);
-                     face_id = merge_faces (it->f, Qt, lface_id,
-                                            it->face_id);
-                   }
+               }
+             if (lface_id)
+               {
+                 escape_glyph = FAST_GLYPH_CHAR (escape_glyph);
+                 face_id = merge_faces (it->f, Qt, lface_id,
+                                        it->face_id);
                }
              else
                {
                  /* Merge the escape-glyph face into the current face.  */
                  face_id = merge_faces (it->f, Qescape_glyph, 0,
                                         it->face_id);
-                 escape_glyph = '\\';
                }

              if (it->c == 0x8a0 || it->c == 0x8ad)



--
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry




reply via email to

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