diff --git a/src/modules/schnorrsig/main_impl.h b/src/modules/schnorrsig/main_impl.h index c37452d43..c443ed688 100644 --- a/src/modules/schnorrsig/main_impl.h +++ b/src/modules/schnorrsig/main_impl.h @@ -298,6 +298,7 @@ int secp256k1_schnorrsig_inc_aggregate(const secp256k1_context *ctx, unsigned ch /* Check that aggsig_size is large enough, i.e. aggsig_size >= 32*(n+1) */ n = n_before + n_new; + ARG_CHECK(n >= n_before); if ((*aggsig_size / 32) <= 0 || ((*aggsig_size / 32)-1) < n) { return 0; }