[njs] Fixed use-of-uninitialized-value for the global this object.

Dmitry Volyntsev xeioex at nginx.com
Fri Jan 17 12:19:44 UTC 2020


details:   https://hg.nginx.org/njs/rev/ef8c8f65ac0e
branches:  
changeset: 1304:ef8c8f65ac0e
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Jan 16 21:29:43 2020 +0300
description:
Fixed use-of-uninitialized-value for the global this object.

Found by MemorySanitizer.

diffstat:

 src/njs_builtin.c |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 6017c94f59b2 -r ef8c8f65ac0e src/njs_builtin.c
--- a/src/njs_builtin.c	Thu Jan 16 19:18:41 2020 +0300
+++ b/src/njs_builtin.c	Thu Jan 16 21:29:43 2020 +0300
@@ -373,6 +373,8 @@ njs_builtin_objects_clone(njs_vm_t *vm, 
     }
 
     vm->global_object.__proto__ = object_prototype;
+
+    njs_set_undefined(global);
     njs_set_object(global, &vm->global_object);
 
     vm->string_object = vm->shared->string_object;


More information about the nginx-devel mailing list