firoorg / firo

The privacy-focused cryptocurrency
https://firo.org
MIT License
721 stars 354 forks source link

Group element deserialization accepts invalid values #1122

Closed AaronFeickert closed 2 years ago

AaronFeickert commented 2 years ago

Group element deserialization in GroupElement::deserialize ignores the return value of this function call: https://github.com/firoorg/firo/blob/master/src/secp256k1/src/cpp/GroupElement.cpp#L528

On invalid input, this results in a GroupElement object being assigned an invalid underlying value. It can be mitigated by calling isMember on the object, but this is not documented.

Deserialization should throw an exception on invalid input, which matches the behavior of the Scalar::deserialize operation.