-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Remove unsafe string mutation code from repo #31821
Comments
I'd like to look into this. |
While we're looking into fixing these we should keep #4720 in mind. I.e. Try to remove |
It's on my radar. Thanks. |
Thanks for contacting us. |
Done via #31850 |
Strings in .NET are immutable, and we want to experiment with runtime features (deduplication, codegen optimizations, etc.) which rely on this fact. To accomplish this we'll need to start moving away from existing code which mutates string instances in-place. Here's a first-pass at all the places in this repo which mutate strings and recommended workarounds for them.
aspnetcore/src/Shared/ServerInfrastructure/StringUtilities.cs
Lines 73 to 94 in 8f56489
(Similar code here and here.)
Suggested workaround (pseudocode):
aspnetcore/src/DataProtection/Cryptography.Internal/src/SafeHandles/BCryptAlgorithmHandle.cs
Lines 78 to 84 in 28a0a53
Suggested workaround: Write to a stackalloced buffer, or rent a char array and write to that, then turn it into a string. Or use
string.Create
and avoid the intermediate rentals.The text was updated successfully, but these errors were encountered: