X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fctf.c;h=9047b7c22eccb38fea4a4e917e37fab9c3905f2c;hb=fd87c9038583f12a2dece6deb4b703d2e6aa25d7;hp=947b439d24349d9055459e3339eec03fc27a2f35;hpb=34b8fff6b83d68f688e84cdf49fdf3ec98c81b4b;p=babeltrace.git diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 947b439d..9047b7c2 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -548,6 +548,11 @@ int ctf_read_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *str goto error; } + if (pos->last_offset == pos->offset) { + fprintf(stderr, "[error] Invalid 0 byte event encountered.\n"); + return -EINVAL; + } + return 0; error: @@ -712,7 +717,7 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence) switch (whence) { case SEEK_CUR: /* The writer will add padding */ - pos->mmap_offset += WRITE_PACKET_LEN / CHAR_BIT; + pos->mmap_offset += pos->packet_size / CHAR_BIT; break; case SEEK_SET: assert(index == 0); /* only seek supported for now */