mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
No length check in AggregatePublicKeys (#9105)
* check of len and nil * minor edit * minor edit Co-authored-by: terence tsao <terence@prysmaticlabs.com>
This commit is contained in:
parent
a860648960
commit
349f832bd3
@ -57,6 +57,9 @@ func AggregatePublicKeys(pubs [][]byte) (common.PublicKey, error) {
|
||||
if featureconfig.Get().SkipBLSVerify {
|
||||
return &PublicKey{}, nil
|
||||
}
|
||||
if pubs == nil || len(pubs) == 0 {
|
||||
return nil, errors.New("nil or empty public keys")
|
||||
}
|
||||
agg := new(blstAggregatePublicKey)
|
||||
mulP1 := make([]*blstPublicKey, 0, len(pubs))
|
||||
for _, pubkey := range pubs {
|
||||
|
@ -76,3 +76,9 @@ func TestPublicKey_Copy(t *testing.T) {
|
||||
|
||||
require.DeepEqual(t, pubkeyA.Marshal(), pubkeyBytes, "Pubkey was mutated after copy")
|
||||
}
|
||||
|
||||
func TestPublicKeysEmpty(t *testing.T) {
|
||||
pubs := [][]byte{}
|
||||
_, err := blst.AggregatePublicKeys(pubs)
|
||||
require.ErrorContains(t, "nil or empty public keys", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user