From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17539: 24.3.91; SIGSEGV due to move_it_in_display_line_to Date: Wed, 21 May 2014 18:09:29 +0300 Message-ID: <83k39fnp7a.fsf@gnu.org> References: <87sio31mkh.fsf@yahoo.fr> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1400685031 21388 80.91.229.3 (21 May 2014 15:10:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 May 2014 15:10:31 +0000 (UTC) Cc: 17539@debbugs.gnu.org To: Nicolas Richard Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 21 17:10:24 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wn89p-0007v9-Ja for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 May 2014 17:10:17 +0200 Original-Received: from localhost ([::1]:60308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn89p-0007pQ-3p for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 May 2014 11:10:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn89f-0007iV-PS for bug-gnu-emacs@gnu.org; Wed, 21 May 2014 11:10:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wn89a-00074U-30 for bug-gnu-emacs@gnu.org; Wed, 21 May 2014 11:10:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn89a-00074E-0I for bug-gnu-emacs@gnu.org; Wed, 21 May 2014 11:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Wn89Z-0005TC-Oi for bug-gnu-emacs@gnu.org; Wed, 21 May 2014 11:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 May 2014 15:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17539 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17539-submit@debbugs.gnu.org id=B17539.140068497420974 (code B ref 17539); Wed, 21 May 2014 15:10:01 +0000 Original-Received: (at 17539) by debbugs.gnu.org; 21 May 2014 15:09:34 +0000 Original-Received: from localhost ([127.0.0.1]:55463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wn895-0005S5-3C for submit@debbugs.gnu.org; Wed, 21 May 2014 11:09:34 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:44754) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wn88z-0005RZ-60 for 17539@debbugs.gnu.org; Wed, 21 May 2014 11:09:29 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0N5X00G00IZ5E600@a-mtaout21.012.net.il> for 17539@debbugs.gnu.org; Wed, 21 May 2014 18:09:19 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N5X00FRRJFIWXA0@a-mtaout21.012.net.il>; Wed, 21 May 2014 18:09:18 +0300 (IDT) In-reply-to: <87sio31mkh.fsf@yahoo.fr> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:89322 Archived-At: > From: Nicolas Richard > 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 + + * 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 * 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;