Merge pull request #2235 from lucas-clemente/crypto-buffer-exceeded

use the CRYPTO_BUFFER_EXCEEDED error for crypto stream overflows
This commit is contained in:
Marten Seemann 2019-11-24 21:06:21 +07:00 committed by GitHub
commit 949a65d490
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View file

@ -69,7 +69,7 @@ func newCryptoStream() cryptoStream {
func (s *cryptoStreamImpl) HandleCryptoFrame(f *wire.CryptoFrame) error {
highestOffset := f.Offset + protocol.ByteCount(len(f.Data))
if maxOffset := highestOffset; maxOffset > protocol.MaxCryptoStreamOffset {
return fmt.Errorf("received invalid offset %d on crypto stream, maximum allowed %d", maxOffset, protocol.MaxCryptoStreamOffset)
return qerr.Error(qerr.CryptoBufferExceeded, fmt.Sprintf("received invalid offset %d on crypto stream, maximum allowed %d", maxOffset, protocol.MaxCryptoStreamOffset))
}
if s.finished {
if highestOffset > s.highestOffset {