[njs] Segfault has been fixed when array element was added

Igor Sysoev igor at sysoev.ru
Sat Apr 9 09:22:48 UTC 2016


details:   http://hg.nginx.org/njs/rev/160e59aaf9bb
branches:  
changeset: 96:160e59aaf9bb
user:      Igor Sysoev <igor at sysoev.ru>
date:      Sat Apr 09 12:18:47 2016 +0300
description:
Segfault has been fixed when array element was added
with assignment.

diffstat:

 njs/njs_vm.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 0e62188391a1 -r 160e59aaf9bb njs/njs_vm.c
--- a/njs/njs_vm.c	Fri Apr 08 18:59:06 2016 +0300
+++ b/njs/njs_vm.c	Sat Apr 09 12:18:47 2016 +0300
@@ -1041,7 +1041,7 @@ njs_array_property_query(njs_vm_t *vm, n
         }
 
         if ((uint32_t) index >= array->size) {
-            ret = njs_array_realloc(vm, array, 0, index);
+            ret = njs_array_realloc(vm, array, 0, index + 1);
             if (nxt_slow_path(ret != NXT_OK)) {
                 return ret;
             }



More information about the nginx-devel mailing list