diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-02-11 19:27:48 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-02-11 19:27:48 +0200 |
commit | 713bfeaab314f4ae943a19205d7db71cb3e70745 (patch) | |
tree | 784f3f87cb99e9d023b328c7df7454cb2d692c84 /src/bidi.c | |
parent | 93e0bed683b04006429c59564f276c2346e13b96 (diff) | |
download | emacs-713bfeaab314f4ae943a19205d7db71cb3e70745.tar.gz |
Fix rare aborts in bidi.c.
src/bidi.c (bidi_resolve_neutral): After finding the next
non-neutral character, accept NEUTRAL_ON type as well, because
directional control characters, such as LRE and RLE, have their
type converted to that by bidi_resolve_weak. This avoids aborts
when LRE/RLE follows a run of neutrals.
(bidi_move_to_visually_next): Assert that return value of
bidi_peek_at_next_level is non-negative. Negative values will
cause an infloop.
Diffstat (limited to 'src/bidi.c')
-rw-r--r-- | src/bidi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bidi.c b/src/bidi.c index b067c8134e3..db2e48a2ca7 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -1973,6 +1973,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) next_type = STRONG_R; break; case WEAK_BN: + case NEUTRAL_ON: /* W6/Retaining */ if (!bidi_explicit_dir_char (bidi_it->ch)) emacs_abort (); /* can't happen: BNs are skipped */ /* FALLTHROUGH */ @@ -2391,6 +2392,10 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it) next_level = bidi_peek_at_next_level (bidi_it); while (next_level != expected_next_level) { + /* If next_level is -1, it means we have an unresolved level + in the cache, which at this point should not happen. If + it does, we will infloop. */ + eassert (next_level >= 0); expected_next_level += incr; level_to_search += incr; bidi_find_other_level_edge (bidi_it, level_to_search, !ascending); |