From 661db9d0831ccbf6b084da4f785638486f4f90db Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 28 Dec 2020 00:48:41 +0000 Subject: [PATCH] Correctly copy frame payload in frame sorter --- internal/multiplex/streamBuffer.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/multiplex/streamBuffer.go b/internal/multiplex/streamBuffer.go index 13cc523..a9fd0fd 100644 --- a/internal/multiplex/streamBuffer.go +++ b/internal/multiplex/streamBuffer.go @@ -82,6 +82,8 @@ func (sb *streamBuffer) Write(f *Frame) (toBeClosed bool, err error) { } saved := *f + saved.Payload = make([]byte, len(f.Payload)) + copy(saved.Payload, f.Payload) heap.Push(&sb.sh, &saved) // Keep popping from the heap until empty or to the point that the wanted seq was not received for len(sb.sh) > 0 && sb.sh[0].Seq == sb.nextRecvSeq {