From: Dmitry Volyntsev Date: Mon, 16 Nov 2026 23:35:46 +0000 (-0800) Subject: WebCrypto: avoid freeing RSA JWK values twice X-Git-Url: https://git.kaiwu.me/%7Bsubstring-before(@doc,%20'.xml')%7D.html?a=commitdiff_plain;h=0e56017276f7edebd5579170096e5431b14008f5;p=njs.git WebCrypto: avoid freeing RSA JWK values twice Previously, RSA JWK import released its parameter values before creating the EVP_PKEY. A failure in EVP_PKEY_new() or EVP_PKEY_set1_RSA() then released the same values in error cleanup. Reset released values so the error handler no longer owns them. The issue was introduced in 75ca26f8 (0.8.10). --- diff --git a/external/qjs_webcrypto_module.c b/external/qjs_webcrypto_module.c index f4b22b69..399eac1f 100644 --- a/external/qjs_webcrypto_module.c +++ b/external/qjs_webcrypto_module.c @@ -3360,12 +3360,20 @@ fail1: JS_FreeValue(cx, dp); JS_FreeValue(cx, dq); JS_FreeValue(cx, qi); + p = JS_UNDEFINED; + q = JS_UNDEFINED; + dp = JS_UNDEFINED; + dq = JS_UNDEFINED; + qi = JS_UNDEFINED; done: JS_FreeValue(cx, n); JS_FreeValue(cx, e); JS_FreeValue(cx, d); + n = JS_UNDEFINED; + e = JS_UNDEFINED; + d = JS_UNDEFINED; pkey = EVP_PKEY_new(); if (pkey == NULL) {