All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yordan Karadzhov <y.karadz@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: rostedt@goodmis.org, Yordan Karadzhov <y.karadz@gmail.com>
Subject: [PATCH] kernel-shark: Fix segfault in libkshark-tepdata
Date: Wed, 17 May 2023 21:28:46 +0300	[thread overview]
Message-ID: <20230517182846.217058-1-y.karadz@gmail.com> (raw)

It turns out that the size of the info field of some events can be zero.

Fixing: 3146d0b (kernel-shark: Do not truncate multi-line events)
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217429
Signed-off-by: Yordan Karadzhov <y.karadz@gmail.com>
---
 src/libkshark-tepdata.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index 2009ca6..b780957 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -825,6 +825,8 @@ static char *get_info_str(struct kshark_data_stream *stream,
 	tep_print_event(kshark_get_tep(stream), &seq, record,
 			"%s", TEP_PRINT_INFO);
 
+	if (!seq.len)
+		return NULL;
 	/*
 	 * The event info string contains a trailing newline.
 	 * Remove this newline.
-- 
2.40.0


                 reply	other threads:[~2023-05-17 18:30 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=20230517182846.217058-1-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.