From: Dmitry Volyntsev Date: Tue, 17 Nov 2026 20:35:56 +0000 (-0800) Subject: WebCrypto: free RSA modulus when exponent import fails in njs X-Git-Url: https://git.kaiwu.me/http/%7Bsubstring-before(@doc,%20'.xml')%7D.html?a=commitdiff_plain;h=f5f41fd816c13a9449b85c791716e83e809617ed;p=njs.git WebCrypto: free RSA modulus when exponent import fails in njs Previously, importing an RSA JWK key leaked the already decoded modulus when decoding the exponent failed, for example when "e" was longer than 512 bytes. Free it, 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 23d0b96d..1df19647 100644 --- a/external/njs_webcrypto_module.c +++ b/external/njs_webcrypto_module.c @@ -3363,6 +3363,7 @@ fail0: e_bn = njs_import_base64url_bignum(vm, &e); if (njs_slow_path(e_bn == NULL)) { + BN_free(n_bn); goto fail; }