Welcome! Log In Create A New Profile

Advanced

[njs] Segfaults in Date have been fixed.

October 11, 2016 10:54AM
details: http://hg.nginx.org/njs/rev/40a753cefac1
branches:
changeset: 193:40a753cefac1
user: Igor Sysoev <igor@sysoev.ru>
date: Tue Oct 11 13:01:41 2016 +0300
description:
Segfaults in Date have been fixed.

diffstat:

njs/njs_date.c | 2 ++
njs/test/njs_unit_test.c | 6 ++++++
2 files changed, 8 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r aa8137bb7838 -r 40a753cefac1 njs/njs_date.c
--- a/njs/njs_date.c Mon Oct 10 17:22:26 2016 +0300
+++ b/njs/njs_date.c Tue Oct 11 13:01:41 2016 +0300
@@ -108,6 +108,7 @@ njs_date_constructor(njs_vm_t *vm, njs_v

for (i = 1; i < n; i++) {
if (!njs_is_numeric(&args[i])) {
+ vm->frame->trap_scratch.data.u.value = &args[i];
return NJS_TRAP_NUMBER_ARG;
}

@@ -186,6 +187,7 @@ njs_date_utc(njs_vm_t *vm, njs_value_t *

for (i = 1; i < n; i++) {
if (!njs_is_numeric(&args[i])) {
+ vm->frame->trap_scratch.data.u.value = &args[i];
return NJS_TRAP_NUMBER_ARG;
}

diff -r aa8137bb7838 -r 40a753cefac1 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Mon Oct 10 17:22:26 2016 +0300
+++ b/njs/test/njs_unit_test.c Tue Oct 11 13:01:41 2016 +0300
@@ -5030,6 +5030,12 @@ static njs_unit_test_t njs_test[] =
{ nxt_string("var d = new Date(); d.__proto__ === Date.prototype"),
nxt_string("true") },

+ { nxt_string("new Date(eval)"),
+ nxt_string("Invalid Date") },
+
+ { nxt_string("Date.UTC(eval)"),
+ nxt_string("NaN") },
+
{ nxt_string("Date.name"),
nxt_string("Date") },


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

[njs] Segfaults in Date have been fixed.

Igor Sysoev 688 October 11, 2016 10:54AM



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

Online Users

Guests: 285
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready