- return;
-
- if (pos->fd >= 0) {
- /*
- * PROT_READ ctf_packet_seek is called from within
- * ctf_pos_get_event so end of packet does not change
- * the packet context on for the last event of the
- * packet.
- */
- if ((pos->prot == PROT_WRITE)
- && (unlikely(pos->offset + bit_offset >= pos->packet_size))) {
- printf_debug("ctf_packet_seek (before call): %" PRId64 "\n",
- pos->offset);
- ctf_packet_seek(&pos->parent, 0, SEEK_CUR);
- printf_debug("ctf_packet_seek (after call): %" PRId64 "\n",
- pos->offset);
- return;
- }
- }
+ return 0;
+ if (pos->prot == PROT_READ)
+ max_len = pos->content_size;
+ else
+ max_len = pos->packet_size;
+ if (unlikely(pos->offset + bit_offset > max_len))
+ return 0;
+