Skip to content

Commit

Permalink
Fixed critical race vulnerability in Cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
oznetmaster committed Mar 14, 2015
1 parent 5a75834 commit 0e58073
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion SSharpSmartThreadPool/SSharpSmartThreadPool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<Programmer />
<ArchiveFilename>C:\Projects\Crestron\Simpl# Pro Libraries\SSharpSmartThreadPool\SSharpSmartThreadPool\bin\Debug\SSharpSmartThreadPool.cplz</ArchiveFilename>
<MinFirmwareVersion>1.009.0029</MinFirmwareVersion>
<CompiledOn>3/14/2015 4:17:08 AM</CompiledOn>
<CompiledOn>3/14/2015 11:03:51 AM</CompiledOn>
<AdditionalInfo />
<EmbedSourceArchive>False</EmbedSourceArchive>
<CopyTo />
Expand Down
9 changes: 8 additions & 1 deletion SSharpSmartThreadPool/SmartThreadPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,14 @@ public override void Cancel (bool abortExecution)

if (abortExecution)
{
foreach (ThreadEntry threadEntry in _workerThreads.Values)
ThreadEntry[] threadEntries;
lock (_workerThreads.SyncRoot)
{
threadEntries = new ThreadEntry[_workerThreads.RealCount];
_workerThreads.Values.CopyTo (threadEntries, 0);
}

foreach (ThreadEntry threadEntry in threadEntries)
{
WorkItem workItem = threadEntry.CurrentWorkItem;
if (null != workItem &&
Expand Down
7 changes: 2 additions & 5 deletions SSharpSmartThreadPoolTests/SSharpSmartThreadPoolTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,10 @@
<Programmer />
<ArchiveFilename>C:\Projects\Crestron\Simpl# Pro Libraries\SSharpSmartThreadPool\SSharpSmartThreadPoolTests\bin\Debug\SSharpSmartThreadPoolTests.cplz</ArchiveFilename>
<MinFirmwareVersion>1.009.0029</MinFirmwareVersion>
<CompiledOn>3/13/2015 10:04:01 AM</CompiledOn>
<CompiledOn>3/14/2015 11:00:21 AM</CompiledOn>
<AdditionalInfo />
<EmbedSourceArchive>False</EmbedSourceArchive>
<CopyTo>
<DebugAnyCPU />
<ReleaseAnyCPU />
</CopyTo>
<CopyTo />
<OriginalReferenceSources>
<Reference sourceFilename="../../SSharpNUnitLite3/SSharpNunitLite/bin/Release/SSharpNunitLite.dll" referenceName="SSharpNunitLite" />
<Reference sourceFilename="../../../Simpl%23%20Libraries/SSharpCrestronExtensionsLibrary/SSharpCrestronExtensionsLibrary/bin/Release/SSharpCrestronExtensionsLibrary.dll" referenceName="SSharpCrestronExtensionsLibrary" />
Expand Down

0 comments on commit 0e58073

Please # to comment.