[njs] A fix in typeof function.

Andrey Zelenkov zelenkov at nginx.com
Thu Oct 20 14:18:41 UTC 2016


details:   http://hg.nginx.org/njs/rev/b290544f11bc
branches:  
changeset: 209:b290544f11bc
user:      Andrey Zelenkov <zelenkov at nginx.com>
date:      Thu Oct 20 17:12:42 2016 +0300
description:
A fix in typeof function.

Found with afl-fuzz.

diffstat:

 njs/njs_vm.c             |  1 +
 njs/test/njs_unit_test.c |  3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diffs (24 lines):

diff -r fa9ced8246e5 -r b290544f11bc njs/njs_vm.c
--- a/njs/njs_vm.c	Tue Oct 18 17:44:01 2016 +0300
+++ b/njs/njs_vm.c	Thu Oct 20 17:12:42 2016 +0300
@@ -1444,6 +1444,7 @@ njs_vmcode_typeof(njs_vm_t *vm, njs_valu
         &njs_string_object,
         &njs_string_function,
         &njs_string_object,
+        &njs_string_object,
     };
 
     vm->retval = *types[value->type];
diff -r fa9ced8246e5 -r b290544f11bc njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Tue Oct 18 17:44:01 2016 +0300
+++ b/njs/test/njs_unit_test.c	Thu Oct 20 17:12:42 2016 +0300
@@ -1795,6 +1795,9 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("typeof /./i"),
       nxt_string("object") },
 
+    { nxt_string("typeof Date.prototype"),
+      nxt_string("object") },
+
     { nxt_string("typeof a"),
       nxt_string("undefined") },
 



More information about the nginx-devel mailing list