From: Paul Eggert Date: Mon, 13 Jun 2011 01:38:25 +0000 (-0700) Subject: * chartab.c (Fchar_table_range): Use CHARACTERP to check range. X-Git-Tag: emacs-pretest-24.0.90~104^2~548^2~40 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8fd02eb7d30a7e0e98cc863e0f3cb81a954fe8a9;p=emacs.git * chartab.c (Fchar_table_range): Use CHARACTERP to check range. Otherwise, an out-of-range integer could cause undefined behavior on a 64-bit host. --- diff --git a/src/ChangeLog b/src/ChangeLog index 8f98b251234..db01d9f291f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-06-13 Paul Eggert + * chartab.c (Fchar_table_range): Use CHARACTERP to check range. + Otherwise, an out-of-range integer could cause undefined behavior + on a 64-bit host. + * composite.c: Use int, not EMACS_INT, for characters. (fill_gstring_body, composition_compute_stop_pos): Use int, not EMACS_INT, for values that are known to be in character range. diff --git a/src/chartab.c b/src/chartab.c index 2f40ceee6ce..ed5b238646e 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -524,15 +524,15 @@ a cons of character codes (for characters in the range), or a character code. * if (EQ (range, Qnil)) val = XCHAR_TABLE (char_table)->defalt; - else if (INTEGERP (range)) - val = CHAR_TABLE_REF (char_table, XINT (range)); + else if (CHARACTERP (range)) + val = CHAR_TABLE_REF (char_table, XFASTINT (range)); else if (CONSP (range)) { int from, to; CHECK_CHARACTER_CAR (range); CHECK_CHARACTER_CDR (range); - val = char_table_ref_and_range (char_table, XINT (XCAR (range)), + val = char_table_ref_and_range (char_table, XFASTINT (XCAR (range)), &from, &to); /* Not yet implemented. */ }