[njs] Added missing element in typeof table for DataView() type.
Dmitry Volyntsev
xeioex at nginx.com
Fri Dec 24 16:58:51 UTC 2021
details: https://hg.nginx.org/njs/rev/256421f5cca2
branches:
changeset: 1787:256421f5cca2
user: Artem S. Povalyukhin <artem.povaluhin at gmail.com>
date: Fri Dec 24 10:00:15 2021 +0300
description:
Added missing element in typeof table for DataView() type.
Previously, typeof operation for DataView object resulted
in out of bounds array accessing.
This fixes #450 issue on Github.
diffstat:
src/njs_vmcode.c | 1 +
src/test/njs_unit_test.c | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
diffs (24 lines):
diff -r 9e2e4d04dfc4 -r 256421f5cca2 src/njs_vmcode.c
--- a/src/njs_vmcode.c Fri Dec 24 16:54:12 2021 +0000
+++ b/src/njs_vmcode.c Fri Dec 24 10:00:15 2021 +0300
@@ -1516,6 +1516,7 @@ njs_vmcode_typeof(njs_vm_t *vm, njs_valu
&njs_string_object,
&njs_string_object,
&njs_string_object,
+ &njs_string_object,
};
vm->retval = *types[value->type];
diff -r 9e2e4d04dfc4 -r 256421f5cca2 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Fri Dec 24 16:54:12 2021 +0000
+++ b/src/test/njs_unit_test.c Fri Dec 24 10:00:15 2021 +0300
@@ -6390,6 +6390,9 @@ static njs_unit_test_t njs_test[] =
{ njs_str("(new DataView(new ArrayBuffer(3)))"),
njs_str("[object DataView]") },
+ { njs_str("var x = new ArrayBuffer(3); [typeof x, typeof new DataView(x)]"),
+ njs_str("object,object") },
+
{ njs_str("(new DataView(new ArrayBuffer(3))).buffer"),
njs_str("[object ArrayBuffer]") },
More information about the nginx-devel
mailing list