Skip to content
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

[release/6.0] [mono] Fix downcast check in Array.CopySlow #64479

Merged
merged 2 commits into from
Feb 7, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jan 28, 2022

Backport of #64469 to release/6.0

/cc @lambdageek

Customer Impact

Valid customer code that copies object[] to a more specific array type with Enum elements may throw unexpected InvalidCastExceptions on WebAssembly, iOS and Android despite working in desktop configurations.

Testing

Manual testing and CI regression testing.

Risk

Moderate: The fix removes a one type check and relaxes another before performing an unsafe copy operation. Existing code is unlikely to become broken. New code may incorrectly allow an unexpected copy of some valuetypes leading to silent data corruption instead of a runtime exception.

where each element in the source array is the appropriate type
When we have to resort to checking element by element, compare the type of each
actual element with the destination type. In particular, not the destinations
underlying type when it's an enum - we don't want to allow unrelated enums
using the same representation to copy over.

Fixes #64387
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@lambdageek lambdageek added Servicing-consider Issue for next servicing release review area-CoreLib-mono labels Jan 29, 2022
@lewing lewing added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Feb 1, 2022
@lambdageek
Copy link
Member

coreclr failure is unrelated

@marek-safar marek-safar added this to the 6.0.x milestone Feb 1, 2022
@safern
Copy link
Member

safern commented Feb 7, 2022

Failure is: #64389

@safern safern merged commit c849005 into release/6.0 Feb 7, 2022
@safern safern deleted the backport/pr-64469-to-release/6.0 branch February 7, 2022 19:41
@ghost ghost locked as resolved and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants