Skip to content

Conversation

@janvorli
Copy link
Member

The DacValidateMD is not resilient to invalid MethodDesc that contains NULL in its m_pMethTab field. It was found when using the ClrMD in the BenchmarkDotNet disassembler code which is trying to find if some constants in the code represent MethodDesc so that it can dump the related method name.

This change fixes it by checking the MethodTable after it is extracted from the MethodDesc. There are two values that are not translated between the target and the debugger sides - NULL and -1. So I have added handling both as invalid there.

The DacValidateMD is not resilient to invalid MethodDesc that contains
NULL in its m_pMethTab field. It was found when using the ClrMD in the
BenchmarkDotNet disassembler code which is trying to find if some constants
in the code represent MethodDesc so that it can dump the related method
name.

This change fixes it by checking the MethodTable after it is extracted
from the MethodDesc. There are two values that are not translated between
the target and the debugger sides - NULL and -1. So I have added handling
both as invalid there.
@ghost
Copy link

ghost commented Dec 20, 2022

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Issue Details

The DacValidateMD is not resilient to invalid MethodDesc that contains NULL in its m_pMethTab field. It was found when using the ClrMD in the BenchmarkDotNet disassembler code which is trying to find if some constants in the code represent MethodDesc so that it can dump the related method name.

This change fixes it by checking the MethodTable after it is extracted from the MethodDesc. There are two values that are not translated between the target and the debugger sides - NULL and -1. So I have added handling both as invalid there.

Author: janvorli
Assignees: janvorli
Labels:

area-Diagnostics-coreclr

Milestone: -

@janvorli janvorli merged commit 934e583 into dotnet:main Dec 20, 2022
@janvorli
Copy link
Member Author

/backport to release/7.0

@github-actions
Copy link
Contributor

Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3743143345

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.

2 participants