diff --git a/source/common/quic/platform/quiche_mem_slice_impl.h b/source/common/quic/platform/quiche_mem_slice_impl.h index fdbb05c39419..d2654dedddfa 100644 --- a/source/common/quic/platform/quiche_mem_slice_impl.h +++ b/source/common/quic/platform/quiche_mem_slice_impl.h @@ -42,6 +42,10 @@ class QuicheMemSliceImpl { QuicheMemSliceImpl& operator=(const QuicheMemSliceImpl& other) = delete; QuicheMemSliceImpl& operator=(QuicheMemSliceImpl&& other) noexcept { if (this != &other) { + // OwnedImpl::move() appends data from `other` without clearing the buffer + // first. It is necessary to call Reset() beforehand to clear + // `single_slice_buffer_`. + Reset(); fragment_ = std::move(other.fragment_); single_slice_buffer_.move(other.single_slice_buffer_); }