Subject: Re: bug#9738: 24.0.90; Crash at overlay-put-ov 'after-string

From: Eli Zaretskii <[email-masked]>
Date: Wed, 12 Oct 2011 19:59:54 +0200

> Date: Wed, 12 Oct 2011 09:43:50 -0700 (PDT)
> From: Daniel Clemente <[email-masked]>
> 
> 1. emacs -Q
> 2. Eval the following:
>   (setq ov (make-overlay 1 2))
>   (overlay-put ov 'after-string "\n111\n2" )
> 3. Crash. This stacktrace appears under gdb:

Please see if the patch below fixes the problem.  I cannot reproduce
the crash with your recipe, so I cannot verify that it's fixed by this
patch.

Thanks.

=== modified file 'src/bidi.c'
--- src/bidi.c	2011-10-12 15:12:52 +0000
+++ src/bidi.c	2011-10-12 17:56:48 +0000
@@ -808,7 +808,6 @@ bidi_init_it (EMACS_INT charpos, EMACS_I
   bidi_it->nchars = -1;	/* to be computed in bidi_resolve_explicit_1 */
   bidi_it->first_elt = 1;
   bidi_set_paragraph_end (bidi_it);
-  bidi_it->paragraph_dir = NEUTRAL_DIR;
   bidi_it->new_paragraph = 1;
   bidi_it->separator_limit = -1;
   bidi_it->type = NEUTRAL_B;

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2011-10-12 15:12:52 +0000
+++ src/xdisp.c	2011-10-12 17:56:28 +0000
@@ -19479,6 +19479,7 @@ See also `bidi-paragraph-direction'.  */
 	    bytepos--;
 	}
       bidi_init_it (pos, bytepos, FRAME_WINDOW_P (SELECTED_FRAME ()), &itb);
+      itb.paragraph_dir = NEUTRAL_DIR;
       itb.string.s = NULL;
       itb.string.lstring = Qnil;
       itb.string.bufpos = 0;