Skip to content

Commit

Permalink
Remove invalid assert in EvpPKeyDuplicate
Browse files Browse the repository at this point in the history
EvpPKeyDuplicate has an invalid assert in it where it asserts that the handle it was passed is not IsInvalid. This may not be true in a multi-threaded scenario where an object is disposed by one thread while another thread is trying to use the resource.

Since we are marshaling the handle as a SafeHandle, just let it do the right thing of throwing an ObjectDisposedException when the marshaller attempts to add a reference to the handle.
  • Loading branch information
vcsjones authored May 19, 2023
1 parent 9c702fb commit 3924920
Showing 1 changed file with 0 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ internal static SafeEvpPKeyHandle EvpPKeyDuplicate(
SafeEvpPKeyHandle currentKey,
EvpAlgorithmId algorithmId)
{
Debug.Assert(!currentKey.IsInvalid);

SafeEvpPKeyHandle pkey = CryptoNative_EvpPKeyDuplicate(
currentKey,
algorithmId);
Expand Down

0 comments on commit 3924920

Please sign in to comment.