From: Dmitry Volyntsev Date: Tue, 17 Nov 2026 20:35:33 +0000 (-0800) Subject: WebCrypto: avoid freeing njs signing contexts twice X-Git-Url: https://git.kaiwu.me/%7Bsubstring-before(@doc,%20'.xml')%7D.html?a=commitdiff_plain;h=a0eaa2230fd36246dbede77a4439b8f9e02a6400;p=njs.git WebCrypto: avoid freeing njs signing contexts twice Previously, sign() and verify() for RSA and ECDSA freed the digest and key contexts at verify_done without resetting the pointers. If creating the resulting ArrayBuffer then failed, the error path freed both contexts again. Reset the pointers after freeing, as the QuickJS implementation does. The issue was introduced in 50e7c9b2 (0.7.10). --- diff --git a/external/njs_webcrypto_module.c b/external/njs_webcrypto_module.c index 9187898b..23d0b96d 100644 --- a/external/njs_webcrypto_module.c +++ b/external/njs_webcrypto_module.c @@ -4965,8 +4965,10 @@ njs_ext_sign(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, verify_done: njs_evp_md_ctx_free(mctx); + mctx = NULL; EVP_PKEY_CTX_free(pctx); + pctx = NULL; break; }