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

[metadata_update] Fix bounds check error #49328

Merged
1 commit merged into from
Mar 9, 2021

Conversation

lambdageek
Copy link
Member

@lambdageek lambdageek commented Mar 8, 2021

The issue is that the STANDALONESIG bounds check was using a 0-based index, and mono_metadata_bounds_check_slow was compensating by adding 1.

But that made another call to the bounds check fail: in mono_class_from_typeref_checked we passed a 1-based index. So in the case where a TypeRef was using the last AssemblyRef in a delta, the bound check would fail.

Fixes #49227

@ghost
Copy link

ghost commented Mar 8, 2021

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

Issue Details

The issue is that the STANDALONESIG bounds check was using a 0-based index, and mono_metadata_bounds_check_slow was compensating by adding 1.

But that made another call to the bounds check (in mono_class_from_typeref_checked) passing a 1-based index that was off by one. So in the case where a TypeRef was using the last AssemblyRef in a delta, the bound check would fail.

Fixes #49227

Author: lambdageek
Assignees: -
Labels:

area-VM-meta-mono

Milestone: -

src/mono/mono/metadata/metadata.c Outdated Show resolved Hide resolved
@lambdageek

This comment has been minimized.

The issue is that the STANDALONESIG bounds check was using a 0-based index, and
mono_metadata_bounds_check_slow was compensating by adding 1.

But that made another call to the bounds check fail: in
mono_class_from_typeref_checked we passed a 1-based index.  So in the case
where a TypeRef was using the last AssemblyRef in a delta, the bound check
would fail.

Fixes dotnet#49227

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
@ghost
Copy link

ghost commented Mar 9, 2021

Hello @lambdageek!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 4db3d3f into dotnet:main Mar 9, 2021
@lambdageek lambdageek mentioned this pull request Mar 9, 2021
51 tasks
@ghost ghost locked as resolved and limited conversation to collaborators Apr 8, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
This pull request was closed.
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.

[mono] ApplyDelta results in BadImageFormatException
3 participants