Skip to content

Commit

Permalink
add check for input byte length
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Mar 3, 2024
1 parent e324d7d commit 8c4be74
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/vm/privacy/ringct.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ func SerializeCompressed(p *ecdsa.PublicKey) []byte {
}

func DeserializeCompressed(curve elliptic.Curve, b []byte) *ecdsa.PublicKey {
if len(b) != 33 {
log.Debug("DeserializeCompresed input []byte is not len 33", "len(b)", len(b))
return nil
}
x := new(big.Int).SetBytes(b[1:33])
// Y = +-sqrt(x^3 + B)
x3 := new(big.Int).Mul(x, x)
Expand Down

0 comments on commit 8c4be74

Please sign in to comment.