details: https://github.com/nginx/njs/commit/e562f44e08c36c28c627fd67d1b2f23d2ed4f949 branches: seg_fault_at_err_msg commit: e562f44e08c36c28c627fd67d1b2f23d2ed4f949 user: Vadim Zhestikov <v.zhesti...@f5.com> date: Wed, 28 May 2025 08:56:22 -0700 description: Fixed segmentation fault at error message.
This closes #918 issue on Github. --- src/njs_value.c | 2 +- src/test/njs_unit_test.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/njs_value.c b/src/njs_value.c index dcdab5a2..9d2065e5 100644 --- a/src/njs_value.c +++ b/src/njs_value.c @@ -609,7 +609,7 @@ njs_property_query(njs_vm_t *vm, njs_property_query_t *pq, njs_value_t *value, default: ret = njs_atom_to_value(vm, &key, atom_id); - if (njs_fast_path(ret == NJS_OK)) { + if (njs_fast_path(ret == NJS_OK) && !njs_is_symbol(&key)) { njs_string_get(vm, &key, &pq->lhq.key); njs_type_error(vm, "cannot get property \"%V\" of %s", &pq->lhq.key, njs_is_null(value) ? "null" diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index 2227c0a6..cae8766b 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -3923,6 +3923,9 @@ static njs_unit_test_t njs_test[] = { njs_str("delete this !== true"), njs_str("false") }, + { njs_str("undefined[Symbol()]"), + njs_str("TypeError: cannot get property \"unknown\" of undefined") }, + /* Object shorthand methods. */ { njs_str("var o = {m(){}}; new o.m();"), _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel