Skip to contentSkip to conversation

Fix segfault in libkshark-tepdata

PATCH In review Yordan Karadzhov 1 participant 2 messages May 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix segfault in libkshark-tepdata

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

---
 src/libkshark-tepdata.c | 2 ++
 1 file changed, 2 insertions(+)
src/libkshark-tepdata.c +2 -0
index 2009ca6..b780957 100644
@@ -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.
Signature · 1 line
2.40.0
#1 lore raw

Please ignore this one.
Thanks!
Y.

Quoted 22 lines · Yordan Karadzhov

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

---
  src/libkshark-tepdata.c | 2 ++
  1 file changed, 2 insertions(+)
src/libkshark-tepdata.c +2 -0
index 2009ca6..b780957 100644
@@ -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.