Welcome! Log In Create A New Profile

Advanced

[njs] Fixed njs_value_property() for NJS_DECLINED from prop handler.

Alexander Borisov
July 22, 2020 08:24AM
details: https://hg.nginx.org/njs/rev/436d4c253d10
branches:
changeset: 1476:436d4c253d10
user: Alexander Borisov <alexander.borisov@nginx.com>
date: Wed Jul 22 15:21:14 2020 +0300
description:
Fixed njs_value_property() for NJS_DECLINED from prop handler.

This ensures retval has valid value for any case except NJS_ERROR.

diffstat:

src/njs_value.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r d88b65c37ecc -r 436d4c253d10 src/njs_value.c
--- a/src/njs_value.c Wed Jul 22 15:21:13 2020 +0300
+++ b/src/njs_value.c Wed Jul 22 15:21:14 2020 +0300
@@ -1033,8 +1033,12 @@ slow_path:
ret = prop->value.data.u.prop_handler(vm, prop, value, NULL,
&prop->value);

- if (njs_slow_path(ret == NJS_ERROR)) {
- return ret;
+ if (njs_slow_path(ret != NJS_OK)) {
+ if (ret == NJS_ERROR) {
+ return ret;
+ }
+
+ njs_set_undefined(&prop->value);
}

*retval = prop->value;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Fixed njs_value_property() for NJS_DECLINED from prop handler.

Alexander Borisov 95 July 22, 2020 08:24AM



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

Online Users

Guests: 84
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