diff options
| author | Eli Zaretskii | 2011-08-18 21:46:02 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-08-18 21:46:02 +0300 |
| commit | 0be6ee069e0911cdac5abe4d2ff53bf32a6d62fc (patch) | |
| tree | b0b68e840fe25d3e50a6252eeadd0af3e6313718 | |
| parent | 92b714445aac9be4227684f9c90cd61c3a0f02d5 (diff) | |
| download | emacs-0be6ee069e0911cdac5abe4d2ff53bf32a6d62fc.tar.gz emacs-0be6ee069e0911cdac5abe4d2ff53bf32a6d62fc.zip | |
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'.
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/bidi.c | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 037a4b28a9e..2b5b6fd0602 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2011-08-18 Eli Zaretskii <eliz@gnu.org> | 1 | 2011-08-18 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * bidi.c (bidi_get_type): If bidi_type_table reports zero as the | ||
| 4 | character bidirectional type, use STRONG_L instead. Fixes crashes | ||
| 5 | in a buffer produced by `describe-categories'. | ||
| 6 | |||
| 3 | * dispextern.h (struct bidi_it): Move disp_pos and disp_prop_p | 7 | * dispextern.h (struct bidi_it): Move disp_pos and disp_prop_p |
| 4 | members before the level stack, so they would be saved and | 8 | members before the level stack, so they would be saved and |
| 5 | restored when copying iterator state. Fixes incorrect reordering | 9 | restored when copying iterator state. Fixes incorrect reordering |
diff --git a/src/bidi.c b/src/bidi.c index c0eee33ab3f..7517eca5aed 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -108,6 +108,8 @@ bidi_get_type (int ch, bidi_dir_t override) | |||
| 108 | abort (); | 108 | abort (); |
| 109 | 109 | ||
| 110 | default_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch)); | 110 | default_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch)); |
| 111 | if (default_type == 0) | ||
| 112 | default_type = STRONG_L; | ||
| 111 | 113 | ||
| 112 | if (override == NEUTRAL_DIR) | 114 | if (override == NEUTRAL_DIR) |
| 113 | return default_type; | 115 | return default_type; |