Welcome! Log In Create A New Profile

Advanced

[njs] Added missing element in typeof table for DataView() type.

Dmitry Volyntsev
December 24, 2021 12:00PM
details: https://hg.nginx.org/njs/rev/256421f5cca2
branches:
changeset: 1787:256421f5cca2
user: Artem S. Povalyukhin <artem.povaluhin@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]") },

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Added missing element in typeof table for DataView() type.

Dmitry Volyntsev 142 December 24, 2021 12:00PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 109
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready