diff mbox series

Fix segfault in libkshark-tepdata

Message ID 20230517182410.216670-1-y.karadz@gmail.com (mailing list archive)
State Accepted
Commit 9f2097c9669fb7d5f72351343f34fb86649d1365
Headers show
Series Fix segfault in libkshark-tepdata | expand

Commit Message

Yordan Karadzhov May 17, 2023, 6:24 p.m. UTC
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(+)

Comments

Yordan Karadzhov May 17, 2023, 6:30 p.m. UTC | #1
Please ignore this one.
Thanks!
Y.

On 5/17/23 21:24, Yordan Karadzhov wrote:
> 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.
diff mbox series

Patch

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.