aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2017-03-11 10:25:05 +0200
committerEli Zaretskii2017-03-11 10:25:05 +0200
commit2b3065f0afa0ef7019735845083395221fe26add (patch)
treef853413d28fbdd71b57f111ff7fff52be7afd7fb /src
parent996fcc74a431e6db819dae1cfbc90ffdc15a222f (diff)
downloademacs-2b3065f0afa0ef7019735845083395221fe26add.tar.gz
emacs-2b3065f0afa0ef7019735845083395221fe26add.zip
Avoid aborts/assertion violations due to 'vim-empty-lines-mode'
* src/xdisp.c (handle_single_display_spec): If position to be restored after processing the display property comes from an overlay, protect against that overlay's end point being outside of the narrowed region. Reported by Filipe Silva <filipe.silva@gmail.com> in http://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00176.html.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 1e7cb4ec665..7ff37a6fb48 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4999,6 +4999,14 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4999 { 4999 {
5000 ptrdiff_t ovendpos = OVERLAY_POSITION (OVERLAY_END (overlay)); 5000 ptrdiff_t ovendpos = OVERLAY_POSITION (OVERLAY_END (overlay));
5001 5001
5002 /* Some borderly-sane Lisp might call us with the current
5003 buffer narrowed so that overlay-end is outside the
5004 POINT_MIN..POINT_MAX region, which will then cause
5005 various assertion violations and crashes down the road,
5006 starting with pop_it when it will attempt to use POSITION
5007 set below. Prevent that. */
5008 ovendpos = clip_to_bounds (BEGV, ovendpos, ZV);
5009
5002 if (ovendpos > CHARPOS (*position)) 5010 if (ovendpos > CHARPOS (*position))
5003 SET_TEXT_POS (*position, ovendpos, CHAR_TO_BYTE (ovendpos)); 5011 SET_TEXT_POS (*position, ovendpos, CHAR_TO_BYTE (ovendpos));
5004 } 5012 }