Skip to content

[mono][interp] Add nullcheck when constant folding vt.GetType - #134095

Merged
BrzVlad merged 1 commit into
dotnet:mainfrom
BrzVlad:fix-interp-gettype-null
Sep 16, 2026
Merged

BrzVlad merged 1 commit into
dotnet:mainfrom
BrzVlad:fix-interp-gettype-null

Conversation

@BrzVlad

@BrzVlad BrzVlad commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

The valuetype pointer can still be null, in which case we need to throw NRE.

Fixes #133992

The valuetype pointer can still be null, in which case we need to throw NRE.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @vitek-karas, @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The null check is added while preserving the existing optimization.

Pull request overview

Fixes Mono interpreter GetType() behavior by throwing NullReferenceException for null value-type pointers during constant folding.

Changes:

  • Emits MINT_CKNULL before loading the constant runtime type.
  • Preserves constant folding for valid pointers.
File summaries
File Description
src/mono/mono/mini/interp/transform.c Adds the required null check during GetType() folding.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

@BrzVlad
BrzVlad enabled auto-merge (squash) September 16, 2026 20:57
@BrzVlad
BrzVlad merged commit 7e0fbdd into dotnet:main Sep 16, 2026
82 of 85 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 17, 2026
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 18, 2026
…#134095)

The valuetype pointer can still be null, in which case we need to throw
NRE.

Fixes dotnet#133992
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ci-scan] Test failure: Runtime_133715.TestEntryPoint on Mono interpreter

3 participants