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)
This commit is contained in:
parent
01e0357ba7
commit
d3c3fe7814
1 changed files with 7 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue