summaryrefslogtreecommitdiff
path: root/src/charset.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-06-12 18:07:35 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-06-12 18:07:35 -0700
commit34206dd201b905b8f9eec84b4e90ba591b06a79a (patch)
tree3a08862ed4619be5f2675986ec463d3432267cee /src/charset.h
parentc5958d4cf336fdbc30364e7d701d6565acaf4002 (diff)
downloademacs-34206dd201b905b8f9eec84b4e90ba591b06a79a.tar.gz
emacs-34206dd201b905b8f9eec84b4e90ba591b06a79a.tar.bz2
emacs-34206dd201b905b8f9eec84b4e90ba591b06a79a.zip
Make sure a 64-bit char is never passed to ENCODE_CHAR.
This is for reasons similar to the recent CHAR_STRING fix. * charset.c (Fencode_char): Check that character arg is actually a character. Pass an int to ENCODE_CHAR. * charset.h (ENCODE_CHAR): Verify that the character argument is no wider than 'int', as a compile-time check to prevent future regressions in this area.
Diffstat (limited to 'src/charset.h')
-rw-r--r--src/charset.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/charset.h b/src/charset.h
index 16f45ff9865..24f0fc46dec 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -27,6 +27,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef EMACS_CHARSET_H
#define EMACS_CHARSET_H
+#include <verify.h>
+
/* Index to arguments of Fdefine_charset_internal. */
enum define_charset_arg_index
@@ -427,7 +429,8 @@ extern Lisp_Object charset_work;
#define ENCODE_CHAR(charset, c) \
((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
? (c) \
- : ((charset)->unified_p \
+ : (!verify_true (sizeof (c) <= sizeof (int)) \
+ || (charset)->unified_p \
|| (charset)->method == CHARSET_METHOD_SUBSET \
|| (charset)->method == CHARSET_METHOD_SUPERSET) \
? encode_char ((charset), (c)) \