Protect the bidi iterator against zero bidi properties.

src/bidi.c (bidi_get_type): If bidi_type_table reports zero as the
 character bidirectional type, use STRONG_L instead.  Fixes crashes
 in a buffer produced by `describe-categories'.
This commit is contained in:
Eli Zaretskii 2011-08-18 21:46:02 +03:00
parent 92b714445a
commit 0be6ee069e
2 changed files with 6 additions and 0 deletions

View file

@ -1,5 +1,9 @@
2011-08-18 Eli Zaretskii <eliz@gnu.org>
* bidi.c (bidi_get_type): If bidi_type_table reports zero as the
character bidirectional type, use STRONG_L instead. Fixes crashes
in a buffer produced by `describe-categories'.
* dispextern.h (struct bidi_it): Move disp_pos and disp_prop_p
members before the level stack, so they would be saved and
restored when copying iterator state. Fixes incorrect reordering

View file

@ -108,6 +108,8 @@ bidi_get_type (int ch, bidi_dir_t override)
abort ();
default_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch));
if (default_type == 0)
default_type = STRONG_L;
if (override == NEUTRAL_DIR)
return default_type;