emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d3c3fe7: Avoid assertion violations in malformed Unicode escapes


From: Eli Zaretskii
Subject: master d3c3fe7: Avoid assertion violations in malformed Unicode escapes
Date: Tue, 20 Oct 2020 11:28:32 -0400 (EDT)

branch: master
commit d3c3fe781424c866ad64ce9a8e3b649b30a0b5ae
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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)
---
 src/lread.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/lread.c b/src/lread.c
index 4b788e9..a3d5fd7 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]