[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17539: 24.3.91; SIGSEGV due to move_it_in_display_line_to
From: |
Eli Zaretskii |
Subject: |
bug#17539: 24.3.91; SIGSEGV due to move_it_in_display_line_to |
Date: |
Wed, 21 May 2014 18:09:29 +0300 |
> 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;