Add missing null check for ctx and input keys in the public API
This commit is contained in:
parent
f4edfc7581
commit
adec5a1638
@ -247,7 +247,7 @@ SECP256K1_API secp256k1_context* secp256k1_context_clone(
|
|||||||
*/
|
*/
|
||||||
SECP256K1_API void secp256k1_context_destroy(
|
SECP256K1_API void secp256k1_context_destroy(
|
||||||
secp256k1_context* ctx
|
secp256k1_context* ctx
|
||||||
);
|
) SECP256K1_ARG_NONNULL(1);
|
||||||
|
|
||||||
/** Set a callback function to be called when an illegal argument is passed to
|
/** Set a callback function to be called when an illegal argument is passed to
|
||||||
* an API call. It will only trigger for violations that are mentioned
|
* an API call. It will only trigger for violations that are mentioned
|
||||||
|
@ -119,7 +119,7 @@ SECP256K1_API secp256k1_context* secp256k1_context_preallocated_clone(
|
|||||||
*/
|
*/
|
||||||
SECP256K1_API void secp256k1_context_preallocated_destroy(
|
SECP256K1_API void secp256k1_context_preallocated_destroy(
|
||||||
secp256k1_context* ctx
|
secp256k1_context* ctx
|
||||||
);
|
) SECP256K1_ARG_NONNULL(1);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ int secp256k1_ecdsa_recoverable_signature_parse_compact(const secp256k1_context*
|
|||||||
int ret = 1;
|
int ret = 1;
|
||||||
int overflow = 0;
|
int overflow = 0;
|
||||||
|
|
||||||
(void)ctx;
|
VERIFY_CHECK(ctx != NULL);
|
||||||
ARG_CHECK(sig != NULL);
|
ARG_CHECK(sig != NULL);
|
||||||
ARG_CHECK(input64 != NULL);
|
ARG_CHECK(input64 != NULL);
|
||||||
ARG_CHECK(recid >= 0 && recid <= 3);
|
ARG_CHECK(recid >= 0 && recid <= 3);
|
||||||
@ -60,7 +60,7 @@ int secp256k1_ecdsa_recoverable_signature_parse_compact(const secp256k1_context*
|
|||||||
int secp256k1_ecdsa_recoverable_signature_serialize_compact(const secp256k1_context* ctx, unsigned char *output64, int *recid, const secp256k1_ecdsa_recoverable_signature* sig) {
|
int secp256k1_ecdsa_recoverable_signature_serialize_compact(const secp256k1_context* ctx, unsigned char *output64, int *recid, const secp256k1_ecdsa_recoverable_signature* sig) {
|
||||||
secp256k1_scalar r, s;
|
secp256k1_scalar r, s;
|
||||||
|
|
||||||
(void)ctx;
|
VERIFY_CHECK(ctx != NULL);
|
||||||
ARG_CHECK(output64 != NULL);
|
ARG_CHECK(output64 != NULL);
|
||||||
ARG_CHECK(sig != NULL);
|
ARG_CHECK(sig != NULL);
|
||||||
ARG_CHECK(recid != NULL);
|
ARG_CHECK(recid != NULL);
|
||||||
@ -75,7 +75,7 @@ int secp256k1_ecdsa_recoverable_signature_convert(const secp256k1_context* ctx,
|
|||||||
secp256k1_scalar r, s;
|
secp256k1_scalar r, s;
|
||||||
int recid;
|
int recid;
|
||||||
|
|
||||||
(void)ctx;
|
VERIFY_CHECK(ctx != NULL);
|
||||||
ARG_CHECK(sig != NULL);
|
ARG_CHECK(sig != NULL);
|
||||||
ARG_CHECK(sigin != NULL);
|
ARG_CHECK(sigin != NULL);
|
||||||
|
|
||||||
|
@ -771,6 +771,7 @@ int secp256k1_ec_pubkey_combine(const secp256k1_context* ctx, secp256k1_pubkey *
|
|||||||
secp256k1_gej Qj;
|
secp256k1_gej Qj;
|
||||||
secp256k1_ge Q;
|
secp256k1_ge Q;
|
||||||
|
|
||||||
|
VERIFY_CHECK(ctx != NULL);
|
||||||
ARG_CHECK(pubnonce != NULL);
|
ARG_CHECK(pubnonce != NULL);
|
||||||
memset(pubnonce, 0, sizeof(*pubnonce));
|
memset(pubnonce, 0, sizeof(*pubnonce));
|
||||||
ARG_CHECK(n >= 1);
|
ARG_CHECK(n >= 1);
|
||||||
@ -779,6 +780,7 @@ int secp256k1_ec_pubkey_combine(const secp256k1_context* ctx, secp256k1_pubkey *
|
|||||||
secp256k1_gej_set_infinity(&Qj);
|
secp256k1_gej_set_infinity(&Qj);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
|
ARG_CHECK(pubnonces[i] != NULL);
|
||||||
secp256k1_pubkey_load(ctx, &Q, pubnonces[i]);
|
secp256k1_pubkey_load(ctx, &Q, pubnonces[i]);
|
||||||
secp256k1_gej_add_ge(&Qj, &Qj, &Q);
|
secp256k1_gej_add_ge(&Qj, &Qj, &Q);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user