all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Change of octal prefix character crashes Emacs [2nd time]
@ 2005-03-01 11:09 Ehud Karni
  2005-03-01 13:41 ` Kim F. Storm
  0 siblings, 1 reply; 2+ messages in thread
From: Ehud Karni @ 2005-03-01 11:09 UTC (permalink / raw)


A few days ago (2005-02-25) I sent a report about a crash in emacs
22.0.50 with a patch that fix it. There was no response, and nobody
installed it in CVS. I'm resending it, hoping someone will look at
it this time.

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 cause of the crash is a bug in `get_next_display_element' in
xdisp.c . The local variable `face_id' is always used but is not
set when there is no face to replacing prefix character.

The patch below fix this bug.

Ehud.


*** /lnx1/gnu/src/emacs/src/xdisp.c.~1.986.~	Sun Feb 27 12:53:09 2005
--- /lnx1/gnu/src/emacs/src/xdisp.c	Tue Mar  1 12:48:06 2005
***************
*** 5087,5097 ****
  		 display.  Then, set IT->dpvec to these glyphs.  */
  	      GLYPH g;
  	      int ctl_len;
! 	      int face_id, lface_id;
  	      GLYPH escape_glyph;

  	      if (it->c < 128 && it->ctl_arrow_p)
  		{
  		  /* Set IT->ctl_chars[0] to the glyph for `^'.  */
  		  if (it->dp
  		      && INTEGERP (DISP_CTRL_GLYPH (it->dp))
--- 5087,5098 ----
  		 display.  Then, set IT->dpvec to these glyphs.  */
  	      GLYPH g;
  	      int ctl_len;
! 	      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))
***************
*** 5099,5117 ****
  		    {
  		      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);
! 			}
  		    }
  		  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);
--- 5100,5117 ----
  		    {
  		      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);
  		    }
  		  else
  		    {
  		      /* Merge the escape-glyph face into the current face.  */
  		      face_id = merge_faces (it->f, Qescape_glyph, 0,
  					     it->face_id);
  		    }

  		  XSETINT (it->ctl_chars[0], g);
***************
*** 5121,5145 ****
  		  goto display_control;
  		}

  	      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);
! 		    }
  		}
  	      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)
--- 5121,5145 ----
  		  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);
  		}
  	      else
  		{
  		  /* Merge the escape-glyph face into the current face.  */
  		  face_id = merge_faces (it->f, Qescape_glyph, 0,
  					 it->face_id);
  		}

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

Diff finished at Tue Mar  1 12:48:28

--
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-01 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-01 11:09 Change of octal prefix character crashes Emacs [2nd time] Ehud Karni
2005-03-01 13:41 ` Kim F. Storm

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.