details: http://hg.nginx.org/njs/rev/da89f264af94 branches: changeset: 194:da89f264af94 user: Igor Sysoev <i...@sysoev.ru> date: Tue Oct 11 17:04:28 2016 +0300 description: Segfaults in increment and decrement operators have been fixed.
diffstat: njs/njs_generator.c | 4 +++- njs/test/njs_unit_test.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletions(-) diffs (34 lines): diff -r 40a753cefac1 -r da89f264af94 njs/njs_generator.c --- a/njs/njs_generator.c Tue Oct 11 13:01:41 2016 +0300 +++ b/njs/njs_generator.c Tue Oct 11 17:04:28 2016 +0300 @@ -21,6 +21,7 @@ #include <njs_variable.h> #include <njs_parser.h> #include <string.h> +#include <stdio.h> static nxt_int_t njs_generator(njs_vm_t *vm, njs_parser_t *parser, @@ -1848,7 +1849,8 @@ njs_generate_inc_dec_operation(njs_vm_t if (node->dest != NULL) { dest_index = node->dest->index; - if (dest_index != lvalue->left->index + if (dest_index != NJS_INDEX_NONE + && dest_index != lvalue->left->index && dest_index != lvalue->right->index) { node->index = dest_index; diff -r 40a753cefac1 -r da89f264af94 njs/test/njs_unit_test.c --- a/njs/test/njs_unit_test.c Tue Oct 11 13:01:41 2016 +0300 +++ b/njs/test/njs_unit_test.c Tue Oct 11 17:04:28 2016 +0300 @@ -471,6 +471,9 @@ static njs_unit_test_t njs_test[] = { nxt_string("[[]+[]]-[]+[[]-[]]"), nxt_string("00") }, + { nxt_string("!--[][1]"), + nxt_string("true") }, + { nxt_string("'true' == true"), nxt_string("false") }, _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel