]> git.kaiwu.me - njs.git/commit
WebCrypto: fix ECDH public key use after free
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 13 Nov 2026 00:48:45 +0000 (16:48 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Mon, 16 Nov 2026 18:13:27 +0000 (10:13 -0800)
commit60a1831564cf58aebc28d6950742ca52a5a34498
tree79a779d056997d3f28021332053372e5f1bbf32b
parent0852c7113209fe65a22904affab2b407cc7b2a96
WebCrypto: fix ECDH public key use after free

Previously, the QuickJS deriveBits() and deriveKey() implementation
for ECDH released the "public" algorithm member right after taking
the key from it.  When the member was returned by a getter and no
other reference was held, the CryptoKey and its EVP_PKEY were freed
before EVP_PKEY_derive() used them.

Now the member value is kept until the derivation is done.

The issue was introduced in 1b69415d (0.9.1).
external/qjs_webcrypto_module.c