Skip to content

Conversation

iksnagreb
Copy link
Contributor

Trying to bind more outputs (from the pattern) than there are actual outputs of the candidate node now simply rejects the node before even trying to index into the list of node outputs.

Trying to bind more outputs (from the pattern) than there are actual
outputs of the candidate node now simply rejects the node before even
trying to index into the list of node outputs.

Signed-off-by: Christoph Berganski <christoph.berganski@gmail.com>
Copy link
Contributor

@Copilot 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 a potential out-of-bounds error in the rewriter module when matching pattern node outputs against actual node outputs. The change prevents indexing into node.outputs when the pattern expects more outputs than the candidate node actually has.

Key Changes

  • Added bounds checking in _match_node method to verify the pattern output index is within the range of actual node outputs

Copy link

codecov bot commented Aug 22, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.05%. Comparing base (e8005e9) to head (a79f117).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
onnxscript/rewriter/_matcher.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2508      +/-   ##
==========================================
- Coverage   70.08%   70.05%   -0.03%     
==========================================
  Files         215      215              
  Lines       25810    25833      +23     
  Branches     2587     2597      +10     
==========================================
+ Hits        18089    18098       +9     
- Misses       6823     6837      +14     
  Partials      898      898              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Christoph Berganski <christoph.berganski@gmail.com>
Copy link
Collaborator

@justinchuby justinchuby left a comment

Choose a reason for hiding this comment

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

Thanks!

@justinchuby justinchuby enabled auto-merge (squash) August 26, 2025 15:12
@justinchuby justinchuby merged commit 3526b42 into microsoft:main Aug 26, 2025
23 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants