Fix: Don't create a new packet if ctf_move_pos() seeks out of a packet
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mathieu Desnoyers
AppliedMerged, thanks!
Mathieu
----- Original Message -----
Quoted 63 lines
From: "Jérémie Galarneau" <[email protected]>
To: [email protected]
Sent: Tuesday, October 15, 2013 1:23:46 PM
Subject: [lttng-dev] [PATCH babeltrace] Fix: Don't create a new packet ifctf_move_pos()seeks out of a packetThis change ensures that
ctf_move_pos()does not create a new packet whenctf_move_pos()moves out of the current packet's bounds. The next call toctf_pos_access_ok()will report EFAULT which can then be handled appropriately by the caller.Signed-off-by Jérémie Galarneau <[email protected]>Reviewed-by Mathieu Desnoyers <[email protected]>--- include/babeltrace/ctf/types.h | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)include/babeltrace/ctf/types.h +0
-17@@ -137,23 +137,6 @@ void ctf_move_pos(struct ctf_stream_pos *pos, uint64_t bit_offset)if (unlikely (pos->offset ==EOF ))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 ; - } - } pos->offset += bit_offset;printf_debug ("ctf_move_pos after increment: %" PRId64"\n" , pos->offset);}
include/babeltrace/ctf/types.h +1
-2@@ -201,7 +184,7 @@ int ctf_pos_packet(struct ctf_stream_pos *dummy)static inline void ctf_pos_pad_packet (struct ctf_stream_pos *pos) { -ctf_move_pos (pos, pos->packet_size - pos->offset); +ctf_packet_seek (&pos->parent,0 ,SEEK_CUR ); } static inline --1.8.4
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 8 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev