Skip to content

Commit 98ed5cf

Browse files
committed
Python: Move not this instanceof ParameterDefinition logic
1 parent 83ca47f commit 98ed5cf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

python/ql/lib/semmle/python/essa/Essa.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,7 @@ class AssignmentDefinition extends EssaNodeDefinition {
501501
ControlFlowNode value;
502502

503503
AssignmentDefinition() {
504-
SsaSource::assignment_definition(this.getSourceVariable(), this.getDefiningNode(), value) and
505-
not this instanceof ParameterDefinition
504+
SsaSource::assignment_definition(this.getSourceVariable(), this.getDefiningNode(), value)
506505
}
507506

508507
ControlFlowNode getValue() { result = value }

python/ql/lib/semmle/python/essa/SsaDefinitions.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ module SsaSource {
2020
/** Holds if `v` is defined by assignment at `defn` and given `value`. */
2121
cached
2222
predicate assignment_definition(Variable v, ControlFlowNode defn, ControlFlowNode value) {
23-
defn.(NameNode).defines(v) and defn.(DefinitionNode).getValue() = value
23+
defn.(NameNode).defines(v) and
24+
defn.(DefinitionNode).getValue() = value and
25+
// since parameter will be considered a DefinitionNode, if it has a default value,
26+
// we need to exclude it here since it is already covered by parameter_definition
27+
// (and points-to was unhappy that it was included in both)
28+
not parameter_definition(v, defn)
2429
}
2530

2631
/** Holds if `v` is defined by assignment of the captured exception. */

0 commit comments

Comments
 (0)