Re: [PATCH] libtraceevent: Handle case of unknown operator
Jean-Michel Hautbois <[email protected]> Tue, 19 Nov 2024 23:01:29 +0100
| Newsgroups | org.kernel.vger.linux-trace-devel |
|---|---|
| Message-ID | <[email protected]> |
Hello Steve, On 19/11/2024 21:18, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" <[email protected]> > > 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/[email protected]/ > > Reported-by: Jean-Michel Hautbois <[email protected]> > Fixes: 6582b0aea1cc ("tools/events: Add files to create libtraceevent.a") > Signed-off-by: Steven Rostedt (Google) <[email protected]> Thank you for your patch ! Tested-by: Jean-Michel Hautbois <[email protected]> > --- > 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);