From: Mathieu Desnoyers Date: Mon, 10 Feb 2014 21:23:24 +0000 (-0500) Subject: Fix: ctf: uninitialized packet_index, misuse of index X-Git-Tag: v1.2.0-rc1~5 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=eb897cf195d5f008bb29242d031990010aeace72 Fix: ctf: uninitialized packet_index, misuse of index Issues introduced by commit f1f52630ef26bb227cf1e8fedcff9b938d7a2f1e Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 515bbe1a..141f9bfa 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -887,9 +887,12 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence) return; } assert(pos->cur_index < pos->packet_index->len); - if (index > 0) { + packet_index = &g_array_index(pos->packet_index, + struct packet_index, pos->cur_index); + if (pos->cur_index > 0) { prev_index = &g_array_index(pos->packet_index, - struct packet_index, index - 1); + struct packet_index, + pos->cur_index - 1); } ctf_update_current_packet_index(&file_stream->parent, prev_index, packet_index);