File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
python/ql/src/semmle/python/functions Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,9 @@ module ModificationOfParameterWithDefault {
139
139
boolean isInverted ( ) { result = inverted }
140
140
}
141
141
142
+ /**
143
+ * A check for the value being truthy or falsy can guard against modifying the default value.
144
+ */
142
145
class IdentityGuard extends BarrierGuard {
143
146
ControlFlowNode checked_node ;
144
147
boolean safe_branch ;
@@ -149,7 +152,7 @@ module ModificationOfParameterWithDefault {
149
152
exists ( IdentityGuarded ig |
150
153
this .getNode ( ) = ig and
151
154
checked_node = this and
152
- // The raw guard is true if the value is non-empty
155
+ // The raw guard is true if the value is non-empty.
153
156
// So we are safe either if we are looking for a non-empty value
154
157
// or if we are looking for an empty value and the guard is inverted.
155
158
safe_branch = ig .isInverted ( ) .booleanXor ( nonEmpty )
You can’t perform that action at this time.
0 commit comments