[njs] Invalid Unicode code point processing has been fixed.

Igor Sysoev igor at sysoev.ru
Tue Oct 18 13:00:40 UTC 2016


details:   http://hg.nginx.org/njs/rev/59b3b4a0b535
branches:  
changeset: 207:59b3b4a0b535
user:      Igor Sysoev <igor at sysoev.ru>
date:      Tue Oct 18 15:48:22 2016 +0300
description:
Invalid Unicode code point processing has been fixed.

diffstat:

 njs/njs_parser.c         |  3 +++
 njs/test/njs_unit_test.c |  3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diffs (26 lines):

diff -r b2a23cf748f8 -r 59b3b4a0b535 njs/njs_parser.c
--- a/njs/njs_parser.c	Tue Oct 18 15:48:19 2016 +0300
+++ b/njs/njs_parser.c	Tue Oct 18 15:48:22 2016 +0300
@@ -2135,6 +2135,9 @@ njs_parser_escape_string_create(njs_vm_t
 
             if (dst != NULL) {
                 dst = nxt_utf8_encode(dst, (uint32_t) u);
+                if (dst == NULL) {
+                    goto invalid;
+                }
             }
         }
 
diff -r b2a23cf748f8 -r 59b3b4a0b535 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Tue Oct 18 15:48:19 2016 +0300
+++ b/njs/test/njs_unit_test.c	Tue Oct 18 15:48:22 2016 +0300
@@ -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") },
 



More information about the nginx-devel mailing list