all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Nicolas Richard <theonewiththeevillook@yahoo.fr>
Cc: 17539@debbugs.gnu.org
Subject: bug#17539: 24.3.91; SIGSEGV due to move_it_in_display_line_to
Date: Wed, 21 May 2014 18:09:29 +0300	[thread overview]
Message-ID: <83k39fnp7a.fsf@gnu.org> (raw)
In-Reply-To: <87sio31mkh.fsf@yahoo.fr>

> From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
> Date: Wed, 21 May 2014 11:57:18 +0200
> 
> $ emacs -Q -f package-initialize ~/tmp/test.csv
> 
> At this point the file visiting buffer is in csv-mode. 
> 
> I then hit C-c C-a to align fields, then C-v a few times, M-v a few more
> times, and I promptly get a crash.
> 
> The file test.csv weighs 11k, so I make it available online at
> http://pastie.org/pastes/9195319/text
> 
> The crash seems to not happen if the frame is too big (i.e. when I
> maximize the frame in gnome before testing), but it happens using -nw.
> 
> Here's the gdb backtrace :
> 
> Starting program: /mnt/gentoo-home/youngfrog/sourcetrees/emacs-git/src/emacs -Q -f package-initialize ~/tmp/test.csv
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
> [New Thread 0xb611ab40 (LWP 19541)]
> [New Thread 0xb558cb40 (LWP 19542)]
> [New Thread 0xb4bffb40 (LWP 19543)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> move_it_in_display_line_to (it=it@entry=0xbfffe038, to_charpos=to_charpos@entry=1980, to_x=to_x@entry=-1, op=op@entry=MOVE_TO_POS) at xdisp.c:8401
> 8401	{
> 
> #0  move_it_in_display_line_to (it=it@entry=0xbfffe038, to_charpos=to_charpos@entry=1980, to_x=to_x@entry=-1, op=op@entry=MOVE_TO_POS) at xdisp.c:8401
> #1  0x0807ca89 in move_it_in_display_line_to (it=it@entry=0xbfffe038, to_charpos=to_charpos@entry=1980, to_x=to_x@entry=-1, op=op@entry=MOVE_TO_POS) at xdisp.c:8896
> [snip the duplicate lines]
> #940 0x0807ca89 in move_it_in_display_line_to (it=it@entry=0xbfffe038, to_charpos=to_charpos@entry=1980, to_x=to_x@entry=-1, op=op@entry=MOVE_TO_POS) at xdisp.c:8896

Thanks, I think I fixed that (emacs-24 branch, revision 117137).  The
patch is below if you want to try that.

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2014-05-20 16:28:39 +0000
+++ src/ChangeLog	2014-05-21 15:03:18 +0000
@@ -1,3 +1,9 @@
+2014-05-21  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (move_it_in_display_line_to): Avoid infinite recursion:
+	when closest_pos is identical to to_charpos, don't recurse, since
+	we already tried that, and failed.  (Bug#17539)
+
 2014-05-20  Eli Zaretskii  <eliz@gnu.org>
 
 	* w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: If we are

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2014-04-18 08:35:09 +0000
+++ src/xdisp.c	2014-05-21 15:03:18 +0000
@@ -8812,8 +8812,11 @@ move_it_in_display_line_to (struct it *i
 		  if (closest_pos < ZV)
 		    {
 		      RESTORE_IT (it, &ppos_it, ppos_data);
-		      move_it_in_display_line_to (it, closest_pos, -1,
-						  MOVE_TO_POS);
+		      /* Don't recurse if closest_pos is equal to
+			 to_charpos, since we have just tried that.  */
+		      if (closest_pos != to_charpos)
+			move_it_in_display_line_to (it, closest_pos, -1,
+						    MOVE_TO_POS);
 		      result = MOVE_POS_MATCH_OR_ZV;
 		    }
 		  else
@@ -8874,8 +8877,9 @@ move_it_in_display_line_to (struct it *i
 		      && !at_eob_p && closest_pos < ZV)
 		    {
 		      RESTORE_IT (it, &ppos_it, ppos_data);
-		      move_it_in_display_line_to (it, closest_pos, -1,
-						  MOVE_TO_POS);
+		      if (closest_pos != to_charpos)
+			move_it_in_display_line_to (it, closest_pos, -1,
+						    MOVE_TO_POS);
 		    }
 		  result = MOVE_POS_MATCH_OR_ZV;
 		  break;
@@ -8893,7 +8897,9 @@ move_it_in_display_line_to (struct it *i
 	      if (closest_pos < ZV)
 		{
 		  RESTORE_IT (it, &ppos_it, ppos_data);
-		  move_it_in_display_line_to (it, closest_pos, -1, MOVE_TO_POS);
+		  if (closest_pos != to_charpos)
+		    move_it_in_display_line_to (it, closest_pos, -1,
+						MOVE_TO_POS);
 		}
 	      result = MOVE_POS_MATCH_OR_ZV;
 	      break;






  reply	other threads:[~2014-05-21 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21  9:57 bug#17539: 24.3.91; SIGSEGV due to move_it_in_display_line_to Nicolas Richard
2014-05-21 15:09 ` Eli Zaretskii [this message]
2014-05-23  8:36   ` Nicolas Richard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83k39fnp7a.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17539@debbugs.gnu.org \
    --cc=theonewiththeevillook@yahoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.