From: Eli Zaretskii Date: Sun, 27 May 2012 12:27:07 +0000 (+0300) Subject: Fix last change in bidi_mirror_char. X-Git-Tag: emacs-24.2.90~471^2~6^2~78 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9e1a06fcf873f4e773d49d0823c566c444df4e8a;p=emacs.git Fix last change in bidi_mirror_char. --- diff --git a/src/ChangeLog b/src/ChangeLog index 264bf1e578c..dabee858320 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-05-27 Eli Zaretskii + + * bidi.c (bidi_mirror_char): Fix last change. + 2012-05-27 Andreas Schwab * unexmacosx.c (copy_data_segment): Truncate after 16 characters diff --git a/src/bidi.c b/src/bidi.c index 70274560dda..29abfb90838 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -204,8 +204,18 @@ bidi_mirror_char (int c) val = CHAR_TABLE_REF (bidi_mirror_table, c); if (INTEGERP (val)) { + int v = XINT (val); + + /* In a build with extra checks, make sure the value does not + overflow a 32-bit int. */ eassert (CHAR_VALID_P (XINT (val))); - return XINT (val); + + /* Minimal test we must do in optimized builds, to prevent weird + crashes further down the road. */ + if (v < 0 || v > MAX_CHAR) + abort (); + + return v; } return c;