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 | |
| parent | bfbbd7e7528f1f4928c305b65ec0f9c55ed628a2 (diff) | |
| download | emacs-39019e542536660936a5fd1a7369ae54fdc6ddd2.tar.gz emacs-39019e542536660936a5fd1a7369ae54fdc6ddd2.zip | |
* lread.c (read_escape): Check for hex character overflow.
| -rw-r--r-- | src/ChangeLog | 1 | ||||
| -rw-r--r-- | src/lread.c | 7 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f0a48ed75ab..e1e9e24fcba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | (read1): Don't assume doc string length fits in int. Check for | 7 | (read1): Don't assume doc string length fits in int. Check for |
| 8 | out-of-range doc string lengths. | 8 | out-of-range doc string lengths. |
| 9 | (read_list): Don't assume file position fits in int. | 9 | (read_list): Don't assume file position fits in int. |
| 10 | (read_escape): Check for hex character overflow. | ||
| 10 | 11 | ||
| 11 | Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking. | 12 | Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking. |
| 12 | The following patches are for when GLYPH_DEBUG && !XASSERT. | 13 | The following patches are for when GLYPH_DEBUG && !XASSERT. |
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); |