[njs] Fixed error handling of setting non-numeric Array.length.
Valentin Bartenev
vbart at nginx.com
Sat Jun 30 17:51:57 UTC 2018
details: http://hg.nginx.org/njs/rev/a361553ce219
branches:
changeset: 543:a361553ce219
user: Valentin Bartenev <vbart at nginx.com>
date: Sat Jun 30 20:39:22 2018 +0300
description:
Fixed error handling of setting non-numeric Array.length.
diffstat:
njs/njs_array.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diffs (15 lines):
diff -r 0307e2740df7 -r a361553ce219 njs/njs_array.c
--- a/njs/njs_array.c Thu Jun 28 17:04:18 2018 +0300
+++ b/njs/njs_array.c Sat Jun 30 20:39:22 2018 +0300
@@ -375,6 +375,11 @@ njs_array_prototype_length(njs_vm_t *vm,
array = value->data.u.array;
if (setval != NULL) {
+ if (!njs_is_number(setval)) {
+ njs_range_error(vm, "Invalid array length");
+ return NJS_ERROR;
+ }
+
num = setval->data.u.number;
length = (uint32_t) num;
More information about the nginx-devel
mailing list