changeset 457:8a274b5f1a04

Fixed 1 byte heap buffer overflow.
author Dmitry Volyntsev <xeioex@nginx.com>
date Tue, 13 Mar 2018 20:37:01 +0300
parents 6738ff52a2cb
children 895355fde02c
files njs/njs_vm.c njs/test/njs_unit_test.c
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/njs/njs_vm.c	Tue Mar 13 19:51:25 2018 +0300
+++ b/njs/njs_vm.c	Tue Mar 13 20:37:01 2018 +0300
@@ -3514,11 +3514,11 @@
 
                 for (i = 0; i < backtrace->items; i++) {
                     if (be[i].line != 0) {
-                        len += sizeof("    at  (:)\n") - 1 + 10
+                        len += sizeof("    at  (:)\n") + 10
                                + be[i].name.length;
 
                     } else {
-                        len += sizeof("    at  (native)\n") - 1
+                        len += sizeof("    at  (native)\n")
                                + be[i].name.length;
                     }
                 }
--- a/njs/test/njs_unit_test.c	Tue Mar 13 19:51:25 2018 +0300
+++ b/njs/test/njs_unit_test.c	Tue Mar 13 20:37:01 2018 +0300
@@ -5706,6 +5706,9 @@
     { nxt_string("Object.prototype.__proto__ === null"),
       nxt_string("true") },
 
+    { nxt_string("Object.prototype.__proto__.f()"),
+      nxt_string("InternalError: method 'f' query failed:-1") },
+
     { nxt_string("Object.prototype.toString.call(Object.prototype)"),
       nxt_string("[object Object]") },