[PATCH] libtraceevent: Handle case of unknown operator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

The m68k architecture had a trace event with "m68k_memory[0].addr >> 13"
in it. The parsing after the ']' and before the '.' checked the priority
of the '.' but because it does not handle '.' as an operator it returned a
negative number. But process_op() did not check for an error and continued
processing. This caused a segfault.

Return immediately if the operator is not handled by get_op_prio().

Link: https://lore.kernel.org/all/20241119112850.219834f5@xxxxxxxxxxxxxxxxxx/

Reported-by: Jean-Michel Hautbois <jeanmichel.hautbois@xxxxxxxxxx>
Fixes: 6582b0aea1cc ("tools/events: Add files to create libtraceevent.a")
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 src/event-parse.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/event-parse.c b/src/event-parse.c
index 0427061603db..a6da8f04cbf3 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -2498,6 +2498,10 @@ process_op(struct tep_event *event, struct tep_print_arg *arg, char **tok)
 
 		/* higher prios need to be closer to the root */
 		prio = get_op_prio(*tok);
+		if (prio < 0) {
+			token = *tok;
+			goto out_free;
+		}
 
 		if (prio > arg->op.prio)
 			return process_op(event, arg, tok);
-- 
2.45.2





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux