-
Notifications
You must be signed in to change notification settings - Fork 84
[Rewriter] Prevent out of range when matching node outputs #2508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Rewriter] Prevent out of range when matching node outputs #2508
Conversation
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>
There was a problem hiding this 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
Codecov Report❌ Patch coverage is
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. |
Signed-off-by: Christoph Berganski <christoph.berganski@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
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.