* lread.c (read_escape): Check for hex character overflow.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 22 Jun 2011 22:39:06 +0000 (15:39 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 22 Jun 2011 22:39:06 +0000 (15:39 -0700)
src/ChangeLog
src/lread.c

index f0a48ed..e1e9e24 100644 (file)
@@ -7,6 +7,7 @@
        (read1): Don't assume doc string length fits in int.  Check for
        out-of-range doc string lengths.
        (read_list): Don't assume file position fits in int.
+       (read_escape): Check for hex character overflow.
 
        Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking.
        The following patches are for when GLYPH_DEBUG && !XASSERT.
index 42ddbfd..a2f78f8 100644 (file)
@@ -2208,6 +2208,8 @@ read_escape (Lisp_Object readcharfun, int stringp)
                UNREAD (c);
                break;
              }
+           if (MAX_CHAR < i)
+             error ("Hex character out of range: \\x%x...", i);
            count++;
          }
 
@@ -2236,10 +2238,7 @@ read_escape (Lisp_Object readcharfun, int stringp)
            else if (c >= 'a' && c <= 'f')  i = (i << 4) + (c - 'a') + 10;
             else if (c >= 'A' && c <= 'F')  i = (i << 4) + (c - 'A') + 10;
            else
-             {
-               error ("Non-hex digit used for Unicode escape");
-               break;
-             }
+             error ("Non-hex digit used for Unicode escape");
          }
        if (i > 0x10FFFF)
          error ("Non-Unicode character: 0x%x", i);