aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-02-11 19:27:48 +0200
committerEli Zaretskii2013-02-11 19:27:48 +0200
commit713bfeaab314f4ae943a19205d7db71cb3e70745 (patch)
tree784f3f87cb99e9d023b328c7df7454cb2d692c84 /src
parent93e0bed683b04006429c59564f276c2346e13b96 (diff)
downloademacs-713bfeaab314f4ae943a19205d7db71cb3e70745.tar.gz
emacs-713bfeaab314f4ae943a19205d7db71cb3e70745.zip
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')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/bidi.c5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e33d2fa5870..b5a1e0d5cb5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12013-02-11 Eli Zaretskii <eliz@gnu.org>
2
3 * bidi.c (bidi_resolve_neutral): After finding the next
4 non-neutral character, accept NEUTRAL_ON type as well, because
5 directional control characters, such as LRE and RLE, have their
6 type converted to that by bidi_resolve_weak. This avoids aborts
7 when LRE/RLE follows a run of neutrals.
8 (bidi_move_to_visually_next): Assert that return value of
9 bidi_peek_at_next_level is non-negative. Negative values will
10 cause an infloop.
11
12013-02-05 Daniel Colascione <dancol@dancol.org> 122013-02-05 Daniel Colascione <dancol@dancol.org>
2 13
3 * emacs.c: Use execvp, not execv, when DAEMON_MUST_EXEC, so that 14 * emacs.c: Use execvp, not execv, when DAEMON_MUST_EXEC, so that
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)
1973 next_type = STRONG_R; 1973 next_type = STRONG_R;
1974 break; 1974 break;
1975 case WEAK_BN: 1975 case WEAK_BN:
1976 case NEUTRAL_ON: /* W6/Retaining */
1976 if (!bidi_explicit_dir_char (bidi_it->ch)) 1977 if (!bidi_explicit_dir_char (bidi_it->ch))
1977 emacs_abort (); /* can't happen: BNs are skipped */ 1978 emacs_abort (); /* can't happen: BNs are skipped */
1978 /* FALLTHROUGH */ 1979 /* FALLTHROUGH */
@@ -2391,6 +2392,10 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
2391 next_level = bidi_peek_at_next_level (bidi_it); 2392 next_level = bidi_peek_at_next_level (bidi_it);
2392 while (next_level != expected_next_level) 2393 while (next_level != expected_next_level)
2393 { 2394 {
2395 /* If next_level is -1, it means we have an unresolved level
2396 in the cache, which at this point should not happen. If
2397 it does, we will infloop. */
2398 eassert (next_level >= 0);
2394 expected_next_level += incr; 2399 expected_next_level += incr;
2395 level_to_search += incr; 2400 level_to_search += incr;
2396 bidi_find_other_level_edge (bidi_it, level_to_search, !ascending); 2401 bidi_find_other_level_edge (bidi_it, level_to_search, !ascending);