]> code.delx.au - gnu-emacs/commitdiff
* bidi.c (bidi_mirror_char): Don't possibly truncate the integer
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 27 May 2012 07:32:46 +0000 (00:32 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 27 May 2012 07:32:46 +0000 (00:32 -0700)
before checking whether it's out of range.  Put the check inside
eassert.  See
<http://lists.gnu.org/archive/html/emacs-devel/2012-05/msg00485.html>.

src/ChangeLog
src/bidi.c

index a9dae7f68aa6199c310fa1f5cd4303b71d2ba224..b0b88a86e9170fdca2b4f8853923d03d7041a44f 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * bidi.c (bidi_mirror_char): Don't possibly truncate the integer
+       before checking whether it's out of range.  Put the check inside
+       eassert.  See
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-05/msg00485.html>.
+
 2012-05-27  Ken Brown  <kbrown@cornell.edu>
 
        * callproc.c (Fcall_process): Restore a line that was accidentally
index efed9dd6cd273dbdac69c13927a8dac0a29b0dae..70274560ddab43c7061efb7e0eb5ef8e02ba4c59 100644 (file)
@@ -204,12 +204,8 @@ bidi_mirror_char (int c)
   val = CHAR_TABLE_REF (bidi_mirror_table, c);
   if (INTEGERP (val))
     {
-      int v = XINT (val);
-
-      if (v < 0 || v > MAX_CHAR)
-       abort ();
-
-      return v;
+      eassert (CHAR_VALID_P (XINT (val)));
+      return XINT (val);
     }
 
   return c;