[njs] Fixed UTF-8 character escaping.

Alexander Borisov alexander.borisov at nginx.com
Wed Jul 10 18:54:58 UTC 2019


details:   https://hg.nginx.org/njs/rev/4a4d55f968a0
branches:  
changeset: 1038:4a4d55f968a0
user:      Alexander Borisov <alexander.borisov at nginx.com>
date:      Wed Jul 10 21:54:33 2019 +0300
description:
Fixed UTF-8 character escaping.

diffstat:

 njs/njs_parser_terminal.c |  1 -
 njs/test/njs_unit_test.c  |  6 ++++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r f1a70d67646d -r 4a4d55f968a0 njs/njs_parser_terminal.c
--- a/njs/njs_parser_terminal.c	Wed Jul 10 14:20:53 2019 +0300
+++ b/njs/njs_parser_terminal.c	Wed Jul 10 21:54:33 2019 +0300
@@ -1047,7 +1047,6 @@ njs_parser_escape_string_create(njs_vm_t
 
             default:
                 if (c >= 0x80) {
-                    src--;
                     goto utf8_copy;
                 }
 
diff -r f1a70d67646d -r 4a4d55f968a0 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Wed Jul 10 14:20:53 2019 +0300
+++ b/njs/test/njs_unit_test.c	Wed Jul 10 21:54:33 2019 +0300
@@ -4537,6 +4537,12 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("'\\u{D800}\\u{'"),
       nxt_string("SyntaxError: Invalid Unicode code point \"\\u{D800}\\u{\" in 1") },
 
+    { nxt_string("'α' !== '\\α'"),
+      nxt_string("false") },
+
+    { nxt_string("'r' !== '\\r'"),
+      nxt_string("true") },
+
     /* Broken UTF-8 literals.*/
 
     { nxt_string("'\\a\x96\xE5\x9C\xE3\x81\xB6'"),


More information about the nginx-devel mailing list