diff options
author | Eli Zaretskii <eliz@gnu.org> | 2020-10-20 18:27:47 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2020-10-20 18:27:47 +0300 |
commit | d3c3fe781424c866ad64ce9a8e3b649b30a0b5ae (patch) | |
tree | 7c2a6a85f3a9252d6d6383deab8feda76ec0665e /src/lread.c | |
parent | 01e0357ba77031dfc66a00822a034e561c0c1ccc (diff) | |
download | emacs-d3c3fe781424c866ad64ce9a8e3b649b30a0b5ae.tar.gz emacs-d3c3fe781424c866ad64ce9a8e3b649b30a0b5ae.tar.bz2 emacs-d3c3fe781424c866ad64ce9a8e3b649b30a0b5ae.zip |
Avoid assertion violations in malformed Unicode escapes
* src/lread.c (read_escape): Produce better diagnostic for
malformed \u Unicode escapes, while avoiding assertion violation
when READCHAR returns -1 because the input is exhausted.
(Bug#44084)
Diffstat (limited to 'src/lread.c')
-rw-r--r-- | src/lread.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lread.c b/src/lread.c index 4b788e99407..a3d5fd7bb81 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2573,6 +2573,13 @@ read_escape (Lisp_Object readcharfun, bool stringp) while (++count <= unicode_hex_count) { c = READCHAR; + if (c < 0) + { + if (unicode_hex_count > 4) + error ("Malformed Unicode escape: \\U%x", i); + else + error ("Malformed Unicode escape: \\u%x", i); + } /* `isdigit' and `isalpha' may be locale-specific, which we don't want. */ int digit = char_hexdigit (c); |