From eb897cf195d5f008bb29242d031990010aeace72 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 10 Feb 2014 16:23:24 -0500 Subject: [PATCH] Fix: ctf: uninitialized packet_index, misuse of index Issues introduced by commit f1f52630ef26bb227cf1e8fedcff9b938d7a2f1e Signed-off-by: Mathieu Desnoyers --- formats/ctf/ctf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.34.1