-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce the nullability bypasses in CryptoPool.Return #55782
Reduce the nullability bypasses in CryptoPool.Return #55782
Conversation
This is a walk over src/libraries/.../*.cs to find any calls to CryptoPool.Return which needed a "!" because of nullability flow. A couple of the bypasses were identifying legitimate issues, and were resolved by moving the Rent to the last thing before the try. A couple were because of the use of ArraySegment which can't structurally promise the array is non-null. But those were usually preceded by a call to ZeroMemory, and there is a CryptoPool.Return(ArraySegment) which does that already, so those "!"s were removed by changing to that overload.
Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @GrabYourPitchforks Issue DetailsThis is a walk over src/libraries/.../*.cs to find any calls to A couple of the bypasses were identifying legitimate issues, A couple were because of the use of ArraySegment which
|
This was the followup promised from #54282 (comment). |
src/libraries/Common/src/System/Security/Cryptography/KeyFormatHelper.Encrypted.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/KeyFormatHelper.Encrypted.cs
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/KeyFormatHelper.Encrypted.cs
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs
Outdated
Show resolved
Hide resolved
...stem.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs8PrivateKeyInfo.cs
Show resolved
Hide resolved
Co-authored-by: Stephen Toub <[email protected]>
This is a walk over src/libraries/.../*.cs to find any calls to
CryptoPool.Return which needed a "!" because of nullability
flow.
A couple of the bypasses were identifying legitimate issues,
and were resolved by moving the Rent to the last thing before
the try.
A couple were because of the use of ArraySegment which
can't structurally promise the array is non-null. But those
were usually preceded by a call to ZeroMemory, and there
is a CryptoPool.Return(ArraySegment) which does that
already, so those "!"s were removed by changing to that
overload.