Skip to content

Conversation

@janvorli
Copy link
Member

@janvorli janvorli commented Feb 4, 2021

There is a problem in the
ClassLoader::ValidateMethodsWithCovariantReturnTypes that results in
failed verification of valid override in case the return type of the
method being overriden is generic in canonical form and it is defined
in an ancestor class that is not the parent.

The problem is that we attempt to use instantiation of the parent class
instead of the ancestor class that contains definition of the method
being overridden.

This change fixes it by locating the proper ancestor MethodTable and
using it.

Close #45053

@janvorli janvorli added this to the 5.0.x milestone Feb 4, 2021
@janvorli janvorli self-assigned this Feb 4, 2021
There is a problem in the
ClassLoader::ValidateMethodsWithCovariantReturnTypes that results in
failed verification of valid override in case the return type of the
method being overriden is generic in canonical form and it is defined
in an ancestor class that is not the parent.

The problem is that we attempt to use instantiation of the parent class
instead of the ancestor class that contains definition of the method
being overriden.

This change fixes it by locating the proper ancestor MethodTable and
using it.
@janvorli janvorli force-pushed the fix-covariant-returns-issue-4 branch from b860bfc to 9b69ad2 Compare February 4, 2021 14:32
@janvorli janvorli merged commit c7c734e into dotnet:master Feb 5, 2021
@janvorli janvorli deleted the fix-covariant-returns-issue-4 branch February 5, 2021 09:34
@janvorli
Copy link
Member Author

janvorli commented Feb 5, 2021

/backport to release/5.0

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2021

Started backporting to release/5.0: https://github.com/dotnet/runtime/actions/runs/539974060

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2021

@janvorli backporting to release/5.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix covariant returns when overriding method of non-parent ancestor
error: sha1 information is lacking or useless (src/coreclr/vm/class.cpp).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix covariant returns when overriding method of non-parent ancestor
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Covariant Return crashes on runtime when there is additional abstract class in between not overriding the abstract method.

2 participants