barectf_packet_set_buf() can change the "full packet" state
Closed this issue · 0 comments
eepp commented
@jgalar witnessed this.
The condition of barectf_packet_is_full()
is
ctx->at == ctx->packet_size
So we're reusing ctx->at
to know whether or not a packet is full.
A full packet is always (already) closed.
The problem is that barectf_packet_set_buf()
changes ctx->packet_size
without touching ctx->at
. Therefore if the value of ctx->packet_size
changes, and if the packet was considered to be full, it's not the case anymore, but it must be.
The solution is probably to always set ctx->at
to ctx->packet_size
too in barectf_packet_set_buf()
.