summaryrefslogtreecommitdiffstats
path: root/openmp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2018-11-28 20:15:11 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2018-11-28 20:15:11 +0000
commitf4c0720ad0bcdb895218cfdc35e72eeea15e294d (patch)
treee58f6dc089e7c5ffcb3d335511d275664a14ee5d /openmp
parenta17318b89b97d577e08c87e6b6c3b67806869f85 (diff)
downloadbcm5719-llvm-f4c0720ad0bcdb895218cfdc35e72eeea15e294d.tar.gz
bcm5719-llvm-f4c0720ad0bcdb895218cfdc35e72eeea15e294d.zip
[OpenMP] Fixed possible array out of bound access
There is low probability that array th_hot_teams can be accessed out of bound (when many nested levels are requested to keep hot teams via KMP_HOT_TEAMS_MAX_LEVEL). The patch adds the check of index that fixes the problem. Patch by Andrey Churbanov Differential Revision: https://reviews.llvm.org/D54950 llvm-svn: 347800
Diffstat (limited to 'openmp')
-rw-r--r--openmp/runtime/src/kmp_runtime.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp
index f2e99565493..44774e946c5 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -2132,6 +2132,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
master_th->th.th_task_state_top++;
#if KMP_NESTED_HOT_TEAMS
if (master_th->th.th_hot_teams &&
+ active_level < __kmp_hot_teams_max_level &&
team == master_th->th.th_hot_teams[active_level].hot_team) {
// Restore master's nested state if nested hot team
master_th->th.th_task_state =
OpenPOWER on IntegriCloud