[njs] Fetch: fixed Headers() constructor.

Dmitry Volyntsev xeioex at nginx.com
Fri Mar 10 22:16:04 UTC 2023


details:   https://hg.nginx.org/njs/rev/95f57822bdaa
branches:  
changeset: 2072:95f57822bdaa
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Mar 10 14:15:29 2023 -0800
description:
Fetch: fixed Headers() constructor.

Previously, the 'guard' field of ngx_js_headers_t structure was uninitialized,
that caused spurious exception "Error: cannot append to immutable object".

This issue was introduced on 0.7.10.

diffstat:

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

diffs (12 lines):

diff -r acacd5d3a276 -r 95f57822bdaa nginx/ngx_js_fetch.c
--- a/nginx/ngx_js_fetch.c	Fri Mar 10 13:28:21 2023 -0800
+++ b/nginx/ngx_js_fetch.c	Fri Mar 10 14:15:29 2023 -0800
@@ -860,6 +860,8 @@ ngx_js_ext_headers_constructor(njs_vm_t 
         return NJS_ERROR;
     }
 
+    headers->guard = GUARD_NONE;
+
     rc = ngx_list_init(&headers->header_list, pool, 4, sizeof(ngx_js_tb_elt_t));
     if (rc != NGX_OK) {
         njs_vm_memory_error(vm);


More information about the nginx-devel mailing list