summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDotnet-GitSync-Bot <45578709+Dotnet-GitSync-Bot@users.noreply.github.com>2019-01-24 17:02:36 -0800
committerJan Kotas <jkotas@microsoft.com>2019-01-24 17:02:36 -0800
commit71d31876aa9f4232c193c3f2fb879c75b04c0658 (patch)
tree9fd74ec54634abb74b051c4dc2aa9cee388da21c
parent64e4a7cb99bdd945656846552700dcedb377cb35 (diff)
downloadcoreclr-71d31876aa9f4232c193c3f2fb879c75b04c0658.tar.gz
coreclr-71d31876aa9f4232c193c3f2fb879c75b04c0658.tar.bz2
coreclr-71d31876aa9f4232c193c3f2fb879c75b04c0658.zip
Fix argument checks in ThreadPool.RegisterWaitForSingleObject. (#6887) (#22196)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
-rw-r--r--src/System.Private.CoreLib/shared/System/Threading/ThreadPool.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Threading/ThreadPool.cs b/src/System.Private.CoreLib/shared/System/Threading/ThreadPool.cs
index e0447c5599..ffcab54c5e 100644
--- a/src/System.Private.CoreLib/shared/System/Threading/ThreadPool.cs
+++ b/src/System.Private.CoreLib/shared/System/Threading/ThreadPool.cs
@@ -49,7 +49,7 @@ namespace System.Threading
}
[StructLayout(LayoutKind.Sequential)] // enforce layout so that padding reduces false sharing
- internal sealed partial class ThreadPoolWorkQueue
+ internal sealed class ThreadPoolWorkQueue
{
internal static class WorkStealingQueueList
{
@@ -943,7 +943,7 @@ namespace System.Threading
)
{
if (millisecondsTimeOutInterval > (uint)int.MaxValue && millisecondsTimeOutInterval != uint.MaxValue)
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_LessEqualToIntegerMaxVal);
return RegisterWaitForSingleObject(waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce, true);
}
@@ -997,6 +997,8 @@ namespace System.Threading
{
if (millisecondsTimeOutInterval < -1)
throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
+ if (millisecondsTimeOutInterval > (uint)int.MaxValue)
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_LessEqualToIntegerMaxVal);
return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, true);
}
@@ -1010,6 +1012,8 @@ namespace System.Threading
{
if (millisecondsTimeOutInterval < -1)
throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
+ if (millisecondsTimeOutInterval > (uint)int.MaxValue)
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_LessEqualToIntegerMaxVal);
return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, false);
}