Skip to content

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Dec 4, 2025

I accidentally merged #20863 a bit too quick; the DCA experiment I ran after addressing review comments revealed a performance bug, which was caused by this change.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Dec 4, 2025
@hvitved hvitved force-pushed the rust/call-refactor-fix branch from d760dac to be1d756 Compare December 4, 2025 20:16
OperationMethodCall() { super.isOverloaded(_, _, _) }

override Expr getPositionalArgument(int i) { result = super.getOperand(i + 1) }
override Expr getPositionalArgument(int i) { result = super.getOperand(i + 1) and i >= 0 }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does not actually matter in practice, since TPositionalArgumentPosition limits positions to be non-negative, however it still makes sense to fix.

@hvitved hvitved added the no-change-note-required This PR does not need a change note label Dec 5, 2025
@hvitved hvitved marked this pull request as ready for review December 5, 2025 07:45
@hvitved hvitved requested a review from a team as a code owner December 5, 2025 07:45
Copilot AI review requested due to automatic review settings December 5, 2025 07:45
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 a performance bug that was introduced in a previous call refactor PR. The bug was caused by using the instanceof pattern instead of multiple inheritance in QL class definitions.

  • Changed CallExprMethodCall from using instanceof restriction to proper multiple inheritance
  • Added defensive constraint i >= 0 to getPositionalArgument in OperationMethodCall
  • Updated test expectations to reflect the corrected dataflow behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
rust/ql/lib/codeql/rust/elements/internal/CallExprImpl.qll Changed CallExprMethodCall from instanceof pattern to multiple inheritance (, separator) to fix performance issue
rust/ql/lib/codeql/rust/elements/internal/OperationImpl.qll Added i >= 0 constraint to getPositionalArgument for defensive bounds checking
rust/ql/test/library-tests/dataflow/sources/net/InlineFlow.expected Updated test expectations to remove spurious dataflow edges that were incorrectly generated before the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hvitved hvitved requested a review from paldepind December 5, 2025 08:07
Copy link
Contributor

@paldepind paldepind left a comment

Choose a reason for hiding this comment

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

LGTM!

@hvitved hvitved merged commit 09461e9 into github:main Dec 5, 2025
27 checks passed
@hvitved hvitved deleted the rust/call-refactor-fix branch December 5, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants