From: Dmitry Volyntsev Date: Thu, 14 May 2026 00:41:05 +0000 (-0700) Subject: Improved error stack frame handling. X-Git-Tag: 0.9.9~6 X-Git-Url: http://git.kaiwu.me/sitemap.xml?a=commitdiff_plain;h=92cc0e61bc9b167d6b375ae640ceb6b2a8572378;p=njs.git Improved error stack frame handling. Native frames always have an associated function. Keep the function lookup in the native-frame branch to make the invariant explicit and to avoid confusing static analysis. Found by Coverity (CID 1681309). --- diff --git a/src/njs_error.c b/src/njs_error.c index 1b38ad61..7c6c0793 100644 --- a/src/njs_error.c +++ b/src/njs_error.c @@ -101,12 +101,6 @@ njs_error_stack_attach(njs_vm_t *vm, njs_value_t value, njs_uint_t skip) continue; } - function = frame->native ? frame->function : NULL; - - if (function != NULL && function->bound != NULL) { - continue; - } - line = 0; file = njs_str_value(""); @@ -135,6 +129,13 @@ njs_error_stack_attach(njs_vm_t *vm, njs_value_t value, njs_uint_t skip) } } else { + function = frame->function; + njs_assert(function != NULL); + + if (njs_slow_path(function->bound != NULL)) { + continue; + } + name.length = 0; fhq.key_hash = NJS_ATOM_STRING_name;