[Openmp-commits] [PATCH] D54950: Fixed possible array out of bound access

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Nov 27 06:41:42 PST 2018


AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: tlwilmar, jlpeyton, hbae.
Herald added a subscriber: openmp-commits.

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.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D54950

Files:
  runtime/src/kmp_runtime.cpp


Index: runtime/src/kmp_runtime.cpp
===================================================================
--- runtime/src/kmp_runtime.cpp
+++ runtime/src/kmp_runtime.cpp
@@ -2132,6 +2132,7 @@
         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 =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54950.175474.patch
Type: text/x-patch
Size: 537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20181127/0e010167/attachment.bin>


More information about the Openmp-commits mailing list