Skip to content

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

4 participants