Fix: barectf_packet_set_buf(): keep full packet state
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.
In barectf_packet_set_buf(), set `ctx->at` to `ctx->packet_size` if it
was already the case to keep any full packet state.
Adding a test with a custom platform calling barectf_packet_set_buf()
with a `NULL` buffer after closing a completely full packet. Without
this patch (in `barectf.c.j2`), this test leads to a segmentation fault.
Fixes: https://github.com/efficios/barectf/issues/18
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.025517 seconds and 4 git commands to generate.