Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320459
b: refs/heads/master
c: 8696329
h: refs/heads/master
i:
  320457: 566afee
  320455: ee8dea5
v: v3
  • Loading branch information
Cody Schafer authored and Arnaldo Carvalho de Melo committed Jul 25, 2012
1 parent e9d4774 commit 8aa8bde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 52f18a2ff9b012a7efdbd520ca0dc0e118a8a837
refs/heads/master: 8696329b7bcf32e69ad12d5975ad1497936d43ec
13 changes: 12 additions & 1 deletion trunk/tools/perf/util/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,18 @@ int symbol__alloc_hist(struct symbol *sym)
{
struct annotation *notes = symbol__annotation(sym);
const size_t size = symbol__size(sym);
size_t sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64));
size_t sizeof_sym_hist;

/* Check for overflow when calculating sizeof_sym_hist */
if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(u64))
return -1;

sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64));

/* Check for overflow in zalloc argument */
if (sizeof_sym_hist > (SIZE_MAX - sizeof(*notes->src))
/ symbol_conf.nr_events)
return -1;

notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist);
if (notes->src == NULL)
Expand Down

0 comments on commit 8aa8bde

Please sign in to comment.