Skip to content

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

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

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

Conversation

@davidwrighton
Copy link
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
Copy link
Contributor

Copilot AI left a comment

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

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants