]> git.kaiwu.me - njs.git/commitdiff
Segfault has been fixed when array element was added
authorIgor Sysoev <igor@sysoev.ru>
Sat, 9 Apr 2016 09:18:47 +0000 (12:18 +0300)
committerIgor Sysoev <igor@sysoev.ru>
Sat, 9 Apr 2016 09:18:47 +0000 (12:18 +0300)
with assignment.

njs/njs_vm.c

index f5ce0f72da8c0bf5da23ecd3d4f5af27d1a06f1a..046ce6926e51d5606a02172a85e83466d6b8aec9 100644 (file)
@@ -1041,7 +1041,7 @@ njs_array_property_query(njs_vm_t *vm, njs_property_query_t *pq,
         }
 
         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;
             }