diff --git a/barretenberg/cpp/src/barretenberg/bbapi/bbapi_srs.cpp b/barretenberg/cpp/src/barretenberg/bbapi/bbapi_srs.cpp index 365eee1bb3ae..1225e844bd4e 100644 --- a/barretenberg/cpp/src/barretenberg/bbapi/bbapi_srs.cpp +++ b/barretenberg/cpp/src/barretenberg/bbapi/bbapi_srs.cpp @@ -61,6 +61,14 @@ SrsInitSrs::Response SrsInitSrs::execute(BB_UNUSED BBApiRequest& request) && SrsInitGrumpkinSrs::Response SrsInitGrumpkinSrs::execute(BB_UNUSED BBApiRequest& request) && { + // Validate buffer size before accessing raw pointer + const size_t required_size = static_cast(num_points) * sizeof(curve::Grumpkin::AffineElement); + if (points_buf.size() < required_size) { + throw_or_abort("SrsInitGrumpkinSrs: points_buf too small (" + std::to_string(points_buf.size()) + + " bytes) for num_points=" + std::to_string(num_points) + " (need " + + std::to_string(required_size) + ")"); + } + // Parse Grumpkin affine elements from buffer std::vector points(num_points); for (uint32_t i = 0; i < num_points; ++i) { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/chonk_recursion_constraints.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/chonk_recursion_constraints.test.cpp index 47af5a7c1aa4..113811ac5e1a 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/chonk_recursion_constraints.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/chonk_recursion_constraints.test.cpp @@ -93,6 +93,7 @@ TEST_F(ChonkRecursionConstraintTest, GenerateRecursiveChonkVerifierVKFromConstra using VerificationKey = ChonkRecursionConstraintTest::VerificationKey; using ChonkData = ChonkRecursionConstraintTest::ChonkData; + BB_DISABLE_ASSERTS(); ChonkData chonk_data = ChonkRecursionConstraintTest::get_chonk_data(); std::shared_ptr vk_from_valid_witness; diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/pairing_impl.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/pairing_impl.hpp index 98b04e9b998e..b0f96b0982db 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/pairing_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/pairing_impl.hpp @@ -287,7 +287,7 @@ fq12 reduced_ate_pairing_batch_precomputed(const g1::affine_element* P_affines, { for (size_t i = 0; i < num_points; ++i) { if (!P_affines[i].on_curve()) { - throw_or_abort("reduced_ate_pairing_batch_precomputed: one of the points is not on the curve."); + bb::assert_failure("reduced_ate_pairing_batch_precomputed: one of the points is not on the curve."); } } @@ -307,10 +307,10 @@ fq12 reduced_ate_pairing_batch(const g1::affine_element* P_affines, bool has_infinity_pair = false; for (size_t i = 0; i < num_points; ++i) { if (!P_affines[i].on_curve()) { - throw_or_abort("reduced_ate_pairing_batch: one of the P points is not on the curve."); + bb::assert_failure("reduced_ate_pairing_batch: one of the P points is not on the curve."); } if (!Q_affines[i].on_curve()) { - throw_or_abort("reduced_ate_pairing_batch: one of the Q points is not on the curve."); + bb::assert_failure("reduced_ate_pairing_batch: one of the Q points is not on the curve."); } // If either P_i or Q_i is the point at infinity, then e(P_i, Q_i) = 1, so we can skip the calculation of