[Openmp-commits] [openmp] r347800 - [OpenMP] Fixed possible array out of bound access

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 28 12:15:11 PST 2018


Author: jlpeyton
Date: Wed Nov 28 12:15:11 2018
New Revision: 347800

URL: http://llvm.org/viewvc/llvm-project?rev=347800&view=rev
Log:
[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

Modified:
    openmp/trunk/runtime/src/kmp_runtime.cpp

Modified: openmp/trunk/runtime/src/kmp_runtime.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.cpp?rev=347800&r1=347799&r2=347800&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.cpp (original)
+++ openmp/trunk/runtime/src/kmp_runtime.cpp Wed Nov 28 12:15:11 2018
@@ -2132,6 +2132,7 @@ int __kmp_fork_call(ident_t *loc, int gt
         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 =




More information about the Openmp-commits mailing list