aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2015-02-08 18:14:14 -0800
committerPaul Eggert2015-02-08 18:14:41 -0800
commit237171731157095f5cc46b0f6f6205e3b4ba9f00 (patch)
tree90a29c2ccdf8fb597f5eb72d85d46535b9309589 /src
parent751adc4b9631cedcf9bec475afe40da4db7d74a1 (diff)
downloademacs-237171731157095f5cc46b0f6f6205e3b4ba9f00.tar.gz
emacs-237171731157095f5cc46b0f6f6205e3b4ba9f00.zip
Fix bidi_explicit_dir_char undefined behavior
* bidi.c (bidi_explicit_dir_char): Avoid subscript error when argument is BIDI_EOB. This can happen in bidi_level_of_next_char.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/bidi.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 017b8f15e3b..3b2c9a6777f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12015-02-09 Paul Eggert <eggert@cs.ucla.edu> 12015-02-09 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Fix bidi_explicit_dir_char undefined behavior
4 * bidi.c (bidi_explicit_dir_char): Avoid subscript error when
5 argument is BIDI_EOB. This can happen in bidi_level_of_next_char.
6
3 Better distinguish infinite from invalid times 7 Better distinguish infinite from invalid times
4 * editfns.c (check_time_validity): New function. 8 * editfns.c (check_time_validity): New function.
5 (decode_time_components): Return int, not bool. 9 (decode_time_components): Return int, not bool.
diff --git a/src/bidi.c b/src/bidi.c
index cbc1820c2a5..e5e08c6a252 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1799,6 +1799,11 @@ bidi_explicit_dir_char (int ch)
1799 1799
1800 if (!bidi_initialized) 1800 if (!bidi_initialized)
1801 emacs_abort (); 1801 emacs_abort ();
1802 if (ch < 0)
1803 {
1804 eassert (ch == BIDI_EOB);
1805 return false;
1806 }
1802 ch_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch)); 1807 ch_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch));
1803 return (ch_type == LRE || ch_type == LRO 1808 return (ch_type == LRE || ch_type == LRO
1804 || ch_type == RLE || ch_type == RLO 1809 || ch_type == RLE || ch_type == RLO