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().
@jgalar witnessed this.
The condition of
barectf_packet_is_full()
isSo 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()
changesctx->packet_size
without touchingctx->at
. Therefore if the value ofctx->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
toctx->packet_size
too inbarectf_packet_set_buf()
.