diff options
| author | Paul Eggert | 2011-06-22 15:39:06 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-22 15:39:06 -0700 |
| commit | 39019e542536660936a5fd1a7369ae54fdc6ddd2 (patch) | |
| tree | acfddec35a7fa196c553bd6066d8685628016c8f /src/lread.c | |
| parent | bfbbd7e7528f1f4928c305b65ec0f9c55ed628a2 (diff) | |
| download | emacs-39019e542536660936a5fd1a7369ae54fdc6ddd2.tar.gz emacs-39019e542536660936a5fd1a7369ae54fdc6ddd2.zip | |
* lread.c (read_escape): Check for hex character overflow.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lread.c b/src/lread.c index 42ddbfd188d..a2f78f848ae 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2208,6 +2208,8 @@ read_escape (Lisp_Object readcharfun, int stringp) | |||
| 2208 | UNREAD (c); | 2208 | UNREAD (c); |
| 2209 | break; | 2209 | break; |
| 2210 | } | 2210 | } |
| 2211 | if (MAX_CHAR < i) | ||
| 2212 | error ("Hex character out of range: \\x%x...", i); | ||
| 2211 | count++; | 2213 | count++; |
| 2212 | } | 2214 | } |
| 2213 | 2215 | ||
| @@ -2236,10 +2238,7 @@ read_escape (Lisp_Object readcharfun, int stringp) | |||
| 2236 | else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; | 2238 | else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; |
| 2237 | else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; | 2239 | else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; |
| 2238 | else | 2240 | else |
| 2239 | { | 2241 | error ("Non-hex digit used for Unicode escape"); |
| 2240 | error ("Non-hex digit used for Unicode escape"); | ||
| 2241 | break; | ||
| 2242 | } | ||
| 2243 | } | 2242 | } |
| 2244 | if (i > 0x10FFFF) | 2243 | if (i > 0x10FFFF) |
| 2245 | error ("Non-Unicode character: 0x%x", i); | 2244 | error ("Non-Unicode character: 0x%x", i); |