From: Paul Eggert Date: Wed, 22 Jun 2011 22:39:06 +0000 (-0700) Subject: * lread.c (read_escape): Check for hex character overflow. X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~438 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=39019e542536660936a5fd1a7369ae54fdc6ddd2;p=emacs.git * lread.c (read_escape): Check for hex character overflow. --- diff --git a/src/ChangeLog b/src/ChangeLog index f0a48ed75ab..e1e9e24fcba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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. 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) 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);