This is an automated email from the ASF dual-hosted git repository. liuhan pushed a commit to branch combine-logical in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git
commit 440e1fce5fc1787082dd4a81a1b252425a469397 Author: mrproliu <[email protected]> AuthorDate: Tue Mar 11 10:35:16 2025 +0800 Fix Combine buffer panic when analyze protocol --- pkg/tools/buffer/buffer.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/tools/buffer/buffer.go b/pkg/tools/buffer/buffer.go index 33f6d1c..5a2ed13 100644 --- a/pkg/tools/buffer/buffer.go +++ b/pkg/tools/buffer/buffer.go @@ -437,9 +437,18 @@ func CombineSlices(validated bool, originalBuffer *Buffer, buffers ...*Buffer) * } } - var endPosition = buffers[len(buffers)-1].endPosition - if endPosition == nil { - endPosition = buffers[len(buffers)-1].Position() + var endPosition *Position + for i := len(buffers) - 1; i >= 0; i-- { + if buffers[i] == nil { + continue + } + if buffers[i].endPosition != nil { + endPosition = buffers[i].endPosition + break + } else if buffers[i].Position() != nil { + endPosition = buffers[i].Position() + break + } } return &Buffer{ dataEvents: dataEvents,
