[Openmp-commits] [openmp] r238216 - One line fix for possible out-of-bounds issue in kmp_runtime.c

Jonathan Peyton jonathan.l.peyton at intel.com
Tue May 26 09:38:26 PDT 2015


Author: jlpeyton
Date: Tue May 26 11:38:26 2015
New Revision: 238216

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


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

Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=238216&r1=238215&r2=238216&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Tue May 26 11:38:26 2015
@@ -6626,7 +6626,7 @@ __kmp_do_middle_initialize( void )
 
     // 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++;
     }





More information about the Openmp-commits mailing list