From b3b0649dd6f10672edbbc748be37d5506b5102dd Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Sat, 1 Sep 2018 21:19:15 +0200 Subject: [PATCH] check size in Reset --- common/buf/buffer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/buf/buffer.go b/common/buf/buffer.go index f716c5564..4f85792e6 100644 --- a/common/buf/buffer.go +++ b/common/buf/buffer.go @@ -67,6 +67,9 @@ func (b *Buffer) Reset(writer Supplier) error { nBytes, err := writer(b.v) b.start = 0 b.end = int32(nBytes) + if b.end > int32(len(b.v)) { + b.end = int32(len(b.v)) + } return err }