]> git.kaiwu.me - njs.git/commitdiff
Segfault is fixed when script is terminated by unbalanced
authorIgor Sysoev <igor@sysoev.ru>
Tue, 12 Jan 2016 17:09:33 +0000 (20:09 +0300)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 12 Jan 2016 17:09:33 +0000 (20:09 +0300)
closing brace.

njs/njs_parser.c
njs/test/njs_unit_test.c

index 82138bcc74e2bb744c703017bd77bd2db3b3d8ad..c7c61681057380792b48cca8a974238cec795a26 100644 (file)
@@ -93,8 +93,7 @@ njs_parser(njs_vm_t *vm, njs_parser_t *parser)
 
         if (token == NJS_TOKEN_CLOSE_BRACE) {
             parser->lexer->start--;
-
-            return parser->node;
+            break;
         }
     }
 
index cc269072e2a9eb94af7acbaef9cb550b57517e5b..2de1ae969d84dfb58011feed655d45f96f8f3821 100644 (file)
@@ -1582,11 +1582,9 @@ static njs_unit_test_t  njs_test[] =
                  "for (i in a) { if (a[i] > 4) break; s += a[i] } s"),
       nxt_string("10") },
 
-#if 0
     { nxt_string("var a = [1,2,3,4,5]; var s = 0;"
                  "for (i in a) if (a[i] > 4) break; s += a[i] } s"),
-      nxt_string("segfault") },
-#endif
+      nxt_string("5") },
 
     /**/