bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#5992: Crash in bidi_paragraph_init


From: Eli Zaretskii
Subject: bug#5992: Crash in bidi_paragraph_init
Date: Wed, 21 Apr 2010 21:14:45 +0300

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Wed, 21 Apr 2010 00:49:15 +0200
> Cc: 
> 
> emacs -Q --eval "(setq-default bidi-display-reordering t)"
> ..\doc\lispref\locals.texi
> 
> 
> Breakpoint 1, w32_abort () at w32fns.c:7349
> 7349      button = MessageBox (NULL,
> (gdb) bt
> #0  w32_abort () at w32fns.c:7349
> #1  0x012bf00b in bidi_paragraph_init (dir=NEUTRAL_DIR,
> bidi_it=0x88d9c8) at bidi.c:909
> #2  0x01066004 in set_iterator_to_next (it=0x88d470, reseat_p=1) at 
> xdisp.c:6260

This happens because texinfo.el defines a local value for
paragraph-start and paragraph-separate that match non-empty lines that
don't need to include newlines:

  (setq paragraph-separate
        (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
  (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))

Thus, "@foo " is a paragraph separator.  The bidi reordering code is
not ready for such surprises, because UAX#9 says:

   The algorithm reorders text only within a paragraph; characters in
   one paragraph have no effect on characters in a different
   paragraph. Paragraphs are divided by the Paragraph Separator or
   appropriate Newline Function [...]. Paragraphs may also be
   determined by higher-level protocols: for example, the text in two
   different cells of a table will be in different paragraphs.

We use the ``higher-level protocols'' fire escape to define a
paragraph in Emacsy way.  But the algorithm still expects the
paragraph to begin and end in a newline.  If paragraph-start and
paragraph-separate don't cooperate, sooner or later bidi.c will crash.

In retrospect, it was too audacious of me to use the buffer-local
value of these two variables, considering the interesting ways in
which various modes define them.

I installed a change that uses only the default values of these
variables.  If people think this is not flexible enough, we can always
add something like bidi-paragraph-start etc., or find some other
solution.






reply via email to

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