diff options
author | Arnaldo Carvalho de Melo <[email protected]> | 2013-11-14 15:30:41 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2013-11-14 16:00:31 -0300 |
commit | 48d038fcd09fa231e254965c3b69f8f640c9e62d (patch) | |
tree | 89341f480fa3e1e86fda5281b8bd18cab7590d3f | |
parent | 37676af15c8d5a9689c9d1220d2a27d510cbe238 (diff) |
perf ui browser: Fix segfault caused by off by one handling END key
$ perf record ls
$ perf report
Press 'down enter end'
Result:
Program received signal SIGSEGV, Segmentation fault.
The UI browser, used on a argv array would access past the end of the
array on SEEK_END because it wasn't using 'nr_entries - 1', fix it.
Reported-by: [email protected]
Cc: Adrian Hunter <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=59291
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/ui/browser.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 3648d4ec041f..cbaa7af45513 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c @@ -569,7 +569,7 @@ void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence) browser->top = browser->top + browser->top_idx + offset; break; case SEEK_END: - browser->top = browser->top + browser->nr_entries + offset; + browser->top = browser->top + browser->nr_entries - 1 + offset; break; default: return; |