Commit 39019e54 authored by Paul Eggert's avatar Paul Eggert
Browse files

* lread.c (read_escape): Check for hex character overflow.

parent bfbbd7e7
......@@ -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.
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment