unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Sebastian Gniazdowski <psprint@zdharma.org>
Cc: 27205@debbugs.gnu.org
Subject: bug#27205: 25.2; Crash on OS X when writing in org-mode
Date: Sat, 03 Jun 2017 11:13:26 +0300	[thread overview]
Message-ID: <83r2z1biah.fsf@gnu.org> (raw)
In-Reply-To: <etPan.593255a2.6b8b4567.a149@MacMini.local> (message from Sebastian Gniazdowski on Sat, 3 Jun 2017 08:22:26 +0200)

> Date: Sat, 3 Jun 2017 08:22:26 +0200
> From: Sebastian Gniazdowski <psprint@zdharma.org>
> 
> I have two stack traces. I think OS X produced one when the crash
> occurred, although function calls aren't the same as lldb backtrace
> done from core. First goes OX backtrace, then lldb's `bt all`. I
> use Spacemacs.
> [...]
> (lldb) bt all
> * thread #1: tid = 0x0000, 0x00007fff868e98ea libsystem_kernel.dylib`__kill + 10, stop reason = signal SIGSTOP
>   * frame #0: 0x00007fff868e98ea libsystem_kernel.dylib`__kill + 10
>     frame #1: 0x00000001000a0f36 Emacs`terminate_due_to_signal + 136
>     frame #2: 0x00000001000b84f5 Emacs`emacs_abort + 19
>     frame #3: 0x00000001001712c3 Emacs`ns_term_shutdown + 122
>     frame #4: 0x00000001000a10f0 Emacs`shut_down_emacs + 261
>     frame #5: 0x00000001000a0f03 Emacs`terminate_due_to_signal + 85
>     frame #6: 0x00000001000b84f5 Emacs`emacs_abort + 19
>     frame #7: 0x000000010008a702 Emacs`bidi_paragraph_init + 885
>     frame #8: 0x000000010001cc34 Emacs`set_iterator_to_next + 1004

I think I fixed this recently on the master branch.  Can you try the
patch below?

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	other threads:[~2017-06-03  8:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03  6:22 bug#27205: 25.2; Crash on OS X when writing in org-mode Sebastian Gniazdowski
2017-06-03  8:13 ` Eli Zaretskii [this message]
2017-06-03  8:40   ` Sebastian Gniazdowski
2017-06-03  9:57     ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83r2z1biah.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=27205@debbugs.gnu.org \
    --cc=psprint@zdharma.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).