linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Douglas RAILLARD <douglas.raillard@arm.com>
Subject: [PATCH] libtraceevent: Fix output of raw prints
Date: Fri, 6 Jan 2023 14:23:41 -0500	[thread overview]
Message-ID: <20230106142341.15df4486@gandalf.local.home> (raw)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

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.

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>
---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/event-parse.c b/src/event-parse.c
index 8167777fccd7..18db7fcb456d 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;
-- 
2.35.1


                 reply	other threads:[~2023-01-06 19:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230106142341.15df4486@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=douglas.raillard@arm.com \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).