[njs] Simplified check for array length limit in njs_array_expand().

Valentin Bartenev vbart at nginx.com
Wed May 8 22:21:07 UTC 2019


details:   https://hg.nginx.org/njs/rev/cb9cbb358a8b
branches:  
changeset: 959:cb9cbb358a8b
user:      Valentin Bartenev <vbart at nginx.com>
date:      Wed May 08 19:09:10 2019 +0300
description:
Simplified check for array length limit in njs_array_expand().

No functional changes.

diffstat:

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

diffs (12 lines):

diff -r 4ed09499a560 -r cb9cbb358a8b njs/njs_array.c
--- a/njs/njs_array.c	Wed May 08 19:09:10 2019 +0300
+++ b/njs/njs_array.c	Wed May 08 19:09:10 2019 +0300
@@ -230,7 +230,7 @@ njs_array_expand(njs_vm_t *vm, njs_array
         size += size / 2;
     }
 
-    if (nxt_slow_path(((prepend + size) * sizeof(njs_value_t)) >= UINT32_MAX)) {
+    if (nxt_slow_path((prepend + size) > NJS_ARRAY_MAX_LENGTH)) {
         goto memory_error;
     }
 


More information about the nginx-devel mailing list