1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-22 18:35:09 +00:00

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.
This commit is contained in:
Paul Eggert 2015-02-08 18:14:14 -08:00
parent 751adc4b96
commit 2371717311
2 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2015-02-09 Paul Eggert <eggert@cs.ucla.edu>
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.
Better distinguish infinite from invalid times
* editfns.c (check_time_validity): New function.
(decode_time_components): Return int, not bool.

View File

@ -1799,6 +1799,11 @@ bidi_explicit_dir_char (int ch)
if (!bidi_initialized)
emacs_abort ();
if (ch < 0)
{
eassert (ch == BIDI_EOB);
return false;
}
ch_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch));
return (ch_type == LRE || ch_type == LRO
|| ch_type == RLE || ch_type == RLO