summaryrefslogtreecommitdiff
path: root/src/bidi.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2012-05-27 15:27:07 +0300
committerEli Zaretskii <eliz@gnu.org>2012-05-27 15:27:07 +0300
commit9e1a06fcf873f4e773d49d0823c566c444df4e8a (patch)
tree2b9428e60cbc28ce8b99de52f8de7a85be85fc00 /src/bidi.c
parentf3dd73121c15514280f6ddd467b00663945b6648 (diff)
downloademacs-9e1a06fcf873f4e773d49d0823c566c444df4e8a.tar.gz
Fix last change in bidi_mirror_char.
Diffstat (limited to 'src/bidi.c')
-rw-r--r--src/bidi.c12
1 files changed, 11 insertions, 1 deletions
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;