Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions barretenberg/cpp/src/barretenberg/bbapi/bbapi_srs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(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<curve::Grumpkin::AffineElement> points(num_points);
for (uint32_t i = 0; i < num_points; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<VerificationKey> vk_from_valid_witness;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
}

Expand All @@ -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
Expand Down
Loading