diff options
author | Teresa Johnson <tejohnson@google.com> | 2012-11-21 16:04:45 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-11-21 16:04:45 +0100 |
commit | aaaefb9d5a04e28ec89e8fc564076d8eae18ca93 (patch) | |
tree | 774fe87fcbefd0504aa31e0ac71f76fae242e13c /gcc/profile.c | |
parent | 5a09d908bcbc74f78d066568c6d535c1e9d6d3fd (diff) | |
download | gcc-aaaefb9d5a04e28ec89e8fc564076d8eae18ca93.zip gcc-aaaefb9d5a04e28ec89e8fc564076d8eae18ca93.tar.gz gcc-aaaefb9d5a04e28ec89e8fc564076d8eae18ca93.tar.bz2 |
re PR gcov-profile/55417 (AddressSanitizer reports stack-buffer-overflow in profiling code)
PR gcov-profile/55417
* profile.c (compute_working_sets): Check index first
to avoid out-of-bounds array access.
From-SVN: r193697
Diffstat (limited to 'gcc/profile.c')
-rw-r--r-- | gcc/profile.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/profile.c b/gcc/profile.c index 194ef91..bbe02b1 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -288,11 +288,11 @@ compute_working_sets (void) else tmp_cum = cum + histo_bucket->cum_value; - /* Next walk through successive working set entries and fill in - the statistics for any whose size we have reached by accumulating - this histogram counter. */ - while (tmp_cum >= working_set_cum_values[ws_ix] - && ws_ix < NUM_GCOV_WORKING_SETS) + /* Next walk through successive working set entries and fill in + the statistics for any whose size we have reached by accumulating + this histogram counter. */ + while (ws_ix < NUM_GCOV_WORKING_SETS + && tmp_cum >= working_set_cum_values[ws_ix]) { gcov_working_sets[ws_ix].num_counters = count; gcov_working_sets[ws_ix].min_counter |