One line fix for possible out-of-bounds issue in kmp_runtime.c
The variable j is now checked so there is no possible
out-of-bounds issue when accessing __kmp_nested_nth.nth[] array.
llvm-svn: 238216
diff --git a/openmp/runtime/src/kmp_runtime.c b/openmp/runtime/src/kmp_runtime.c
index 4ab998b..195f8a1 100644
--- a/openmp/runtime/src/kmp_runtime.c
+++ b/openmp/runtime/src/kmp_runtime.c
@@ -6626,7 +6626,7 @@
// If there were empty places in num_threads list (OMP_NUM_THREADS=,,2,3), correct them now
j = 0;
- while ( __kmp_nested_nth.used && ! __kmp_nested_nth.nth[ j ] ) {
+ while ( ( j < __kmp_nested_nth.used ) && ! __kmp_nested_nth.nth[ j ] ) {
__kmp_nested_nth.nth[ j ] = __kmp_dflt_team_nth = __kmp_dflt_team_nth_ub = __kmp_avail_proc;
j++;
}