emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2b3065f: Avoid aborts/assertion violations due to '


From: Eli Zaretskii
Subject: [Emacs-diffs] master 2b3065f: Avoid aborts/assertion violations due to 'vim-empty-lines-mode'
Date: Sat, 11 Mar 2017 03:27:10 -0500 (EST)

branch: master
commit 2b3065f0afa0ef7019735845083395221fe26add
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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 <address@hidden> in
    http://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00176.html.
---
 src/xdisp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/xdisp.c b/src/xdisp.c
index 1e7cb4ec..7ff37a6 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,
        {
          ptrdiff_t ovendpos = OVERLAY_POSITION (OVERLAY_END (overlay));
 
+         /* Some borderly-sane Lisp might call us with the current
+            buffer narrowed so that overlay-end is outside the
+            POINT_MIN..POINT_MAX region, which will then cause
+            various assertion violations and crashes down the road,
+            starting with pop_it when it will attempt to use POSITION
+            set below.  Prevent that.  */
+         ovendpos = clip_to_bounds (BEGV, ovendpos, ZV);
+
          if (ovendpos > CHARPOS (*position))
            SET_TEXT_POS (*position, ovendpos, CHAR_TO_BYTE (ovendpos));
        }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]