]> git.kaiwu.me - njs.git/commitdiff
Invalid Unicode code point processing has been fixed.
authorIgor Sysoev <igor@sysoev.ru>
Tue, 18 Oct 2016 12:48:22 +0000 (15:48 +0300)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 18 Oct 2016 12:48:22 +0000 (15:48 +0300)
njs/njs_parser.c
njs/test/njs_unit_test.c

index 9dda40c648ed2b87312c49ce5b8f89c9f02d85cd..bb42bd55965d699e4aa0baf4f6738f7a002fbf73 100644 (file)
@@ -2135,6 +2135,9 @@ njs_parser_escape_string_create(njs_vm_t *vm, njs_parser_t *parser,
 
             if (dst != NULL) {
                 dst = nxt_utf8_encode(dst, (uint32_t) u);
+                if (dst == NULL) {
+                    goto invalid;
+                }
             }
         }
 
index 7cee5636450fb2caab9f97f080ff5a33e51385e2..5ffee20f856947a3892129ead7b5ab16738f5960 100644 (file)
@@ -2660,6 +2660,9 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("'\\u{1234567}'"),
       nxt_string("SyntaxError: Invalid Unicode code point \"\\u{1234567}\" in 1") },
 
+    { nxt_string("'\\u{a00000}'"),
+      nxt_string("SyntaxError: Invalid Unicode code point \"\\u{a00000}\" in 1") },
+
     { nxt_string("'\\x61'"),
       nxt_string("a") },