Messages in this thread | | | Date | Thu, 17 Aug 2017 10:02:49 -0700 | From | Andi Kleen <> | Subject | Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error |
| |
On Thu, Aug 17, 2017 at 01:25:39PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Aug 17, 2017 at 08:34:22AM -0700, Andi Kleen escreveu: > > > Humm, but don't we have that checked? > > > > At least not in the case of the segfault below. > > Again: > > tools/perf/util/parse-events.c > > 2523 void parse_events_evlist_error(struct parse_events_evlist *data, > 2524 int idx, const char *str) > 2525 { > 2526 struct parse_events_error *err = data->error; > 2527 > 2528 if (!err) > 2529 return; > 2530 err->idx = idx; > 2531 err->str = strdup(str); > 2532 WARN_ONCE(!err->str, "WARNING: failed to allocate error string"); > 2533 } > > data->error _is_ being checked for NULL, and the hunk you added would
In the crash, data->error is not NULL, it's random stack contents because the data types for the data pointer do not match (parse_events_evlist vs parse_events_terms)
-Andi
| |