Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[clr-interp] Array allocation exception has incorrect exception#120981

Merged
davidwrighton merged 1 commit into
dotnet:mainfrom
davidwrighton:fix_array_alloc_exceptions
Oct 22, 2025
Merged

[clr-interp] Array allocation exception has incorrect exception#120981
davidwrighton merged 1 commit into
dotnet:mainfrom
davidwrighton:fix_array_alloc_exceptions

Conversation

@davidwrighton

Copy link
Copy Markdown
Member
  • The actual helper throws the right exception (which is OverflowException)
  • Don't add an incorrect check

- The actual helper throws the right exception (which is OverflowException)
- Don't add an incorrect check
Copilot AI review requested due to automatic review settings October 22, 2025 18:32

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.

Pull Request Overview

This PR fixes an exception handling issue in the CLR interpreter's array allocation code. The removed manual validation was throwing the wrong exception type (ArgumentOutOfRangeException) when it should throw OverflowException, which the underlying helper already correctly handles.

  • Removes duplicate and incorrect exception checks for negative array lengths in INTOP_NEWARR and INTOP_NEWARR_GENERIC cases
  • Relies on the helper function to throw the correct OverflowException instead

@janvorli janvorli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you!

Comment thread src/coreclr/vm/interpexec.cpp
@davidwrighton davidwrighton merged commit b7a761c into dotnet:main Oct 22, 2025
99 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ExceptionHandling-coreclr only use for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants