Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Ensure BitArray unsafe accesses are within bounds#39270

Merged
jkotas merged 1 commit intodotnet:masterfrom
stephentoub:bitarrayunsafe
Jul 8, 2019
Merged

Ensure BitArray unsafe accesses are within bounds#39270
jkotas merged 1 commit intodotnet:masterfrom
stephentoub:bitarrayunsafe

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Jul 7, 2019

To avoid any potential issues that could arise from concurrent mutation of a BitArray while it's doing unsafe processing (e.g. one thread calling And/Or/Xor while another thread resizes the BitArray via set_Length), this changes the implementations that use unsafe code to operate on a local snapshot that's fully validated locally.

Fixes https://github.com/dotnet/corefx/issues/39204
cc: @GrabYourPitchforks, @jkotas

To avoid any potential issues that could arise from concurrent mutation of a BitArray while its doing unsafe processing (e.g. one thread calling And/Or/Xor while another thread resizes the BitArray via set_Length), this changes the implementations that use unsafe code to operate on a local snapshot that's fully validated locally.
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jkotas jkotas merged commit 3b426f7 into dotnet:master Jul 8, 2019
@stephentoub stephentoub deleted the bitarrayunsafe branch July 8, 2019 11:57
@BruceForstall BruceForstall mentioned this pull request Jul 8, 2019
@karelz karelz added this to the 3.0 milestone Jul 16, 2019
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
To avoid any potential issues that could arise from concurrent mutation of a BitArray while its doing unsafe processing (e.g. one thread calling And/Or/Xor while another thread resizes the BitArray via set_Length), this changes the implementations that use unsafe code to operate on a local snapshot that's fully validated locally.

Commit migrated from dotnet/corefx@3b426f7
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BitArray race conditions may lead to memory corruption

3 participants