Barrier: Fix potential locking issue (#17944)

* Barrier: Fix potential locking issue

* add changelog
This commit is contained in:
Brian Kassouf 2022-11-16 09:53:22 -08:00 committed by GitHub
parent 775a1b3001
commit 288b0567b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

3
changelog/17944.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
core: Fix potential deadlock if barrier ciphertext is less than 4 bytes.
```

View File

@ -1069,11 +1069,13 @@ func (b *AESGCMBarrier) Decrypt(_ context.Context, key string, ciphertext []byte
}
if len(ciphertext) == 0 {
b.l.RUnlock()
return nil, fmt.Errorf("empty ciphertext")
}
// Verify the term
if len(ciphertext) < 4 {
b.l.RUnlock()
return nil, fmt.Errorf("invalid ciphertext term")
}
term := binary.BigEndian.Uint32(ciphertext[:4])