possible fix for rare panic
This commit is contained in:
parent
f0af1fb04d
commit
88861102fd
4 changed files with 20 additions and 17 deletions
|
|
@ -77,6 +77,8 @@ func (r *reader) Read(p []byte) (int, error) {
|
|||
return n, nil
|
||||
}
|
||||
|
||||
var ErrDecrypt = errors.New("failed to decrypt and authenticate payload chunk")
|
||||
|
||||
func (r *reader) readChunk() (last bool, err error) {
|
||||
if len(r.unread) != 0 {
|
||||
panic("stream: internal error: readChunk called with dirty buffer")
|
||||
|
|
@ -105,7 +107,7 @@ func (r *reader) readChunk() (last bool, err error) {
|
|||
out, err = r.a.Open(r.outBuf, r.nonce[:], in, nil)
|
||||
}
|
||||
if err != nil {
|
||||
return false, errors.New("failed to decrypt and authenticate payload chunk")
|
||||
return false, ErrDecrypt
|
||||
}
|
||||
|
||||
incNonce(&r.nonce)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue