Skip to content
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

[dataflowengineoss] take into account frontends that use the -1 index for named arguments #5000

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

xavierpinho
Copy link
Contributor

-1 is used to denote a call's return value. However, some frontends (e.g. python) also use this index for named arguments. When specifying FlowSemantics, the criteria for deciding if a FlowSemantic taints the return value was not taking this fact into account. This makes sure that -1 only denotes the return value if it's not in the context of a named argument specification.

@xavierpinho xavierpinho added bug Something isn't working python Relates to pysrc2cpg dataflow engine Relates to dataflowengineoss labels Oct 14, 2024
case _ => false
// Some frontends (e.g. python) denote named arguments using `-1` as the argument index. As such
// `-1` denotes the return value only if there's no argument name.
case FlowMapping(_, ParameterNode(-1, None)) => true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah good catch. Yes argumentIndex = -1 is the default value, it is "unset" but in this instance it'll clash with the return value logic

@xavierpinho xavierpinho merged commit 9e1a466 into master Oct 14, 2024
5 checks passed
@xavierpinho xavierpinho deleted the xavierp/flow-return-named-arg branch October 14, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dataflow engine Relates to dataflowengineoss python Relates to pysrc2cpg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants