From a14e15687ce2e0a02e27bf85f70b3d9c7dfdf850 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 24 Oct 2011 16:16:02 -0700 Subject: [PATCH] * character.c (Funibyte_string): Use CHECK_RANGED_INTEGER instead. --- src/ChangeLog | 2 +- src/character.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5b41db9831a..46c22caeea9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -106,7 +106,7 @@ (str_as_unibyte, str_to_unibyte, string_count_byte8) (string_escape_byte8, Fget_byte): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. - (Funibyte_string): Use CHECK_CHARACTER, not CHECK_NATNUM, to + (Funibyte_string): Use CHECK_RANGED_INTEGER, not CHECK_NATNUM, to avoid mishandling large integers. * character.h: Adjust decls to match defn changes elsewhere. * charset.c (load_charset_map_from_file, find_charsets_in_text) diff --git a/src/character.c b/src/character.c index 1e8c75d2597..3517dbba47d 100644 --- a/src/character.c +++ b/src/character.c @@ -924,7 +924,6 @@ usage: (unibyte-string &rest BYTES) */) (ptrdiff_t n, Lisp_Object *args) { ptrdiff_t i; - int c; unsigned char *buf, *p; Lisp_Object str; USE_SAFE_ALLOCA; @@ -934,11 +933,8 @@ usage: (unibyte-string &rest BYTES) */) for (i = 0; i < n; i++) { - CHECK_CHARACTER (args[i]); - c = XFASTINT (args[i]); - if (c >= 256) - args_out_of_range_3 (args[i], make_number (0), make_number (255)); - *p++ = c; + CHECK_RANGED_INTEGER (0, args[i], 255); + *p++ = XINT (args[i]); } str = make_string_from_bytes ((char *) buf, n, p - buf); -- 2.39.2