Writer: don't allow more than one packet without packet context
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 27 Jan 2017 05:41:39 +0000 (00:41 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:36 +0000 (12:57 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/stream.c

index 979d40e92839fd94f066bad1d8d226e5153e170b..e6e7575a7102c63415c75241cca3e102ed93e1af 100644 (file)
@@ -884,6 +884,16 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream)
                goto end;
        }
 
+       if (!stream->packet_context && stream->flushed_packet_count > 0) {
+               /*
+                * A stream without a packet context, and thus without
+                * content and packet size members, can't have more than
+                * one packet.
+                */
+               ret = -1;
+               goto end;
+       }
+
        empty_packet = (stream->events->len == 0);
        ret = bt_ctf_field_validate(stream->packet_header);
        if (ret) {
This page took 0.024406 seconds and 4 git commands to generate.