diff --git a/src/util-streaming-buffer.c b/src/util-streaming-buffer.c index 39147ebc1e..911504a1b3 100644 --- a/src/util-streaming-buffer.c +++ b/src/util-streaming-buffer.c @@ -1201,7 +1201,11 @@ static StreamingBufferRegion *BufferInsertAtRegionConsolidate(StreamingBuffer *s DEBUG_VALIDATE_BUG_ON(dst_size != dst->buf_size); if (dst_copy_offset != 0) memmove(dst->buf + dst_copy_offset, dst->buf, old_size); - dst->stream_offset = dst_offset; + if (dst_offset != dst->stream_offset) { + dst->stream_offset = dst_offset; + // buf_offset no longer valid, reset. + dst->buf_offset = 0; + } uint32_t new_offset = src_start->buf_offset; if (data_offset == src_start->stream_offset + src_start->buf_offset) {