Skip to content

CPP: Prevent forced bad join order which is saved by context. - #18828

Merged
alexet merged 2 commits into
github:mainfrom
alexet:alexet/fix-flakey-join-order
Feb 24, 2025
Merged

alexet merged 2 commits into
github:mainfrom
alexet:alexet/fix-flakey-join-order

Conversation

@alexet

@alexet alexet commented Feb 20, 2025

Copy link
Copy Markdown
Contributor

It is impossible to avoid a CP in this predicate on it's own.

Picking getClassAndName first is always a CP as it doesn't use nameWithoutArgs. This disjunct cannot be picked as not method instanceof ConversionOperator requires method to be bound first.

In practice the argument result also happens to be bound at the call site, so getClassAndName is not a CP at the call site. However the call site has no idea that we need method to be bound and we join order assuming that it isn't so it. We also assume it isn't bound internally. This means that the join order is quite sensitive.

An alternative would be to add result to the binding set to get a similar effect to what we do now (I wasn't sure whether to make this do what seems to be intended or whether to preserve the existing join order).

@alexet
alexet requested a review from MathiasVP February 20, 2025 16:42
Copilot AI review requested due to automatic review settings February 20, 2025 16:42
@alexet
alexet requested a review from a team as a code owner February 20, 2025 16:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@github-actions github-actions Bot added the C++ label Feb 20, 2025
@alexet alexet added the no-change-note-required This PR does not need a change note label Feb 20, 2025
Comment thread cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll Fixed

@aschackmull aschackmull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@jketema

jketema commented Feb 24, 2025

Copy link
Copy Markdown
Contributor

FYI: I've kicked-off a DCA experiment.

@alexet
alexet merged commit ddfb168 into github:main Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants