File tree Expand file tree Collapse file tree
barretenberg/cpp/src/barretenberg/avm_fuzzer/harness Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,11 +114,25 @@ struct EccFuzzerInput {
114114
115115 static EccFuzzerInput from_buffer (const uint8_t * buffer)
116116 {
117+ // Note: we cannot use AffinePoint::serialize_from_buffer() because this now throws if the point is not on the
118+ // curve. We want to test such points so have to deserialize manually:
119+ auto read_point = [](const uint8_t * src) -> AffinePoint {
120+ bool is_point_at_infinity =
121+ std::all_of (src, src + (sizeof (Fq) * 2 ), [](uint8_t val) { return val == 255 ; });
122+ if (is_point_at_infinity) {
123+ return AffinePoint::infinity ();
124+ }
125+ AffinePoint result;
126+ read (src, result.x );
127+ read (src, result.y );
128+ return result;
129+ };
130+
117131 EccFuzzerInput input;
118132 size_t offset = 0 ;
119- input.p = AffinePoint::serialize_from_buffer (buffer + offset);
133+ input.p = read_point (buffer + offset);
120134 offset += sizeof (AffinePoint);
121- input.q = AffinePoint::serialize_from_buffer (buffer + offset);
135+ input.q = read_point (buffer + offset);
122136 offset += sizeof (AffinePoint);
123137 input.scalar = Fq::serialize_from_buffer (buffer + offset);
124138 offset += sizeof (Fq);
You can’t perform that action at this time.
0 commit comments