diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2023-01-06 14:23:41 -0500 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2023-01-06 17:14:13 -0500 |
commit | 0c28cec1e409653095dea0511c24fd9849b2862f (patch) | |
tree | c26d0fb374341df214c0356cdeacd589c664da65 | |
parent | 87213bcf6542de48ee5391cb403728f8c8c6a300 (diff) | |
download | libtraceevent-0c28cec1e409653095dea0511c24fd9849b2862f.tar.gz |
libtraceevent: Fix output of raw prints
The raw prints that uses the parsed fields directly, had a bug in it where
the check to catch if reading the event went beyond the event size it
would warn. But instead of testing against the event size, it was testing
against the field size. The test was suppose to test:
field->offset + field->size > data_size
Which would catch an overflow, but instead it was testing:
field->offset + field->size > field->size
Which will always be true! (well, if the field was not at the beginning of
the data, which is always is due to meta data).
Have it check the data size and not the field size.
Link: https://lore.kernel.org/linux-trace-devel/20230106142341.15df4486@gandalf.local.home
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216896
Reported-by: Douglas RAILLARD <douglas.raillard@arm.com>
Fixes: 09f02890358a2 ("libtraceevent: Improve tep_print_field()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | src/event-parse.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/event-parse.c b/src/event-parse.c index 8167777..18db7fc 100644 --- a/src/event-parse.c +++ b/src/event-parse.c @@ -6032,7 +6032,7 @@ static inline void print_field(struct trace_seq *s, void *data, int size, if (has_0x) trace_seq_puts(s, "0x"); - print_parse_data(parse, s, data, field->size, event); + print_parse_data(parse, s, data, size, event); if (parse_ptr) *parse_ptr = parse->next; |