Skip to content

Commit

Permalink
Fix out of range access in GetRecycleMemoryInfo (#26873)
Browse files Browse the repository at this point in the history
  • Loading branch information
303248153 committed Oct 3, 2019
1 parent db48b17 commit 3461971
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vm/win32threadpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,9 @@ class ThreadpoolMgr
#else // !FEATURE_PAL
if (PAL_HasGetCurrentProcessorNumber())
{
processorNumber = GetCurrentProcessorNumber();
// On linux, GetCurrentProcessorNumber which uses sched_getcpu() can return a value greater than the number
// of processors reported by sysconf(_SC_NPROCESSORS_ONLN) when using OpenVZ kernel.
processorNumber = GetCurrentProcessorNumber()%NumberOfProcessors;
}
#endif // !FEATURE_PAL
return pRecycledListPerProcessor[processorNumber][memType];
Expand Down

0 comments on commit 3461971

Please sign in to comment.