Skip to content

Commit

Permalink
src: check EC_POINT_get_affine_coordinates result
Browse files Browse the repository at this point in the history
PR-URL: nodejs#42304
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
  • Loading branch information
tniessen authored Mar 14, 2022
1 parent 7a601f9 commit 4aae536
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/crypto/crypto_ec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,11 @@ Maybe<void> ExportJWKEcKey(
BignumPointer x(BN_new());
BignumPointer y(BN_new());

EC_POINT_get_affine_coordinates(group, pub, x.get(), y.get(), nullptr);
if (!EC_POINT_get_affine_coordinates(group, pub, x.get(), y.get(), nullptr)) {
ThrowCryptoError(env, ERR_get_error(),
"Failed to get elliptic-curve point coordinates");
return Nothing<void>();
}

if (target->Set(
env->context(),
Expand Down

0 comments on commit 4aae536

Please sign in to comment.