perf tools: Pre-check sample size before parsing
Check that the total size of the sample fields having a fixed size do not exceed the one of the whole event. This robustifies the sample parsing. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Stephane Eranian <eranian@google.com>
This commit is contained in:
parent
74429964d8
commit
a285412479
7 changed files with 41 additions and 5 deletions
|
@ -690,8 +690,9 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
|
|||
return PyErr_NoMemory();
|
||||
|
||||
first = list_entry(evlist->entries.next, struct perf_evsel, node);
|
||||
perf_event__parse_sample(event, first->attr.sample_type, sample_id_all,
|
||||
&pevent->sample);
|
||||
perf_event__parse_sample(event, first->attr.sample_type,
|
||||
perf_sample_size(first->attr.sample_type),
|
||||
sample_id_all, &pevent->sample);
|
||||
return pyevent;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue