From dcf9684256679564d4917b78448381a0d499bce5 Mon Sep 17 00:00:00 2001 From: compudj Date: Tue, 16 Oct 2007 03:32:57 +0000 Subject: [PATCH] fix off-by-one in marker id test git-svn-id: http://ltt.polymtl.ca/svn@2703 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/marker.c | 1 + ltt/branches/poly/ltt/marker.h | 2 +- ltt/branches/poly/ltt/tracefile.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ltt/branches/poly/ltt/marker.c b/ltt/branches/poly/ltt/marker.c index 54209570..2a0d1cb1 100644 --- a/ltt/branches/poly/ltt/marker.c +++ b/ltt/branches/poly/ltt/marker.c @@ -440,6 +440,7 @@ int marker_id_event(LttTrace *trace, GQuark name, guint16 id, info->pointer_size = pointer_size; info->size_t_size = size_t_size; info->alignment = alignment; + info->fields = NULL; info->next = NULL; head = marker_get_info_from_name(trace, name); if (!head) diff --git a/ltt/branches/poly/ltt/marker.h b/ltt/branches/poly/ltt/marker.h index e3d4cd3d..73c7f247 100644 --- a/ltt/branches/poly/ltt/marker.h +++ b/ltt/branches/poly/ltt/marker.h @@ -52,7 +52,7 @@ static inline guint16 marker_get_id_from_info(LttTrace *trace, static inline struct marker_info *marker_get_info_from_id(LttTrace *trace, guint16 id) { - if (unlikely(trace->markers->len < id)) + if (unlikely(trace->markers->len <= id)) return NULL; return &g_array_index(trace->markers, struct marker_info, id); } diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 097e9d2e..5ce20f2f 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -1874,6 +1874,7 @@ int ltt_tracefile_read_update_event(LttTracefile *tf) pos += sizeof(guint16); } else { /* Compact event */ + event->event_size = 0xFFFF; } if (a_event_debug) @@ -2113,6 +2114,7 @@ void ltt_update_event_size(LttTracefile *tf) } info = marker_get_info_from_id(tf->trace, tf->event.event_id); + if (tf->event.event_id >= MARKER_CORE_IDS) g_assert(info != NULL); -- 2.34.1