On Tue, 19 Nov 2024 11:28:50 -0500
Steven Rostedt <rost...@goodmis.org> wrote:

> print fmt: "page=%p pfn=0x%lx flags=%s", (mem_map + ((REC->pfn) - 
> (m68k_memory[0].addr >> 13))), REC->pfn, (REC->reclaim_flags) ? 
> __print_flags(REC->reclaim_flags, "|", {0x0001u, "RECLAIM_WB_ANON"}, 
> {0x0002u, "RECLAIM_WB_FILE"}, {0x0010u, "RECLAIM_WB_MIXED"}, {0x0004u, 
> "RECLAIM_WB_SYNC"}, {0x0008u, "RECLAIM_WB_ASYNC"} ) : "RECLAIM_WB_NONE"

Running gdb on this, I found that it crashed on the "m68k_memory[0].addr"
because it failed to fail on the '.' that it doesn't know how to parse.

This patch should stop the crash (against libtraceevent)

-- Steve

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);

Reply via email to