Skip to content

Commit

Permalink
Fix Combine buffer panic when analyze protocol (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrproliu authored Mar 11, 2025
1 parent ecb6e8c commit ff46ccf
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/tools/buffer/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ff46ccf

Please sign in to comment.