From: Adrian Hunter Date: Tue, 22 Oct 2013 07:34:17 +0000 (+0300) Subject: perf tools: Do not accept parse_tag_value() overflow X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=56921becdd1eb0720603fc2e6e4c7f518196d917;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git perf tools: Do not accept parse_tag_value() overflow parse_tag_value() accepts an "unsigned long" and multiplies it according to a tag character. Do not accept the value if the multiplication overflows. Signed-off-by: Adrian Hunter Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1382427258-17495-14-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index c25e57b3acb2..28a0a89c1f73 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -386,6 +386,8 @@ unsigned long parse_tag_value(const char *str, struct parse_tag *tags) if (s != endptr) break; + if (value > ULONG_MAX / i->mult) + break; value *= i->mult; return value; }