Skip to content

Commit d834cec

Browse files
committed
Python: test simple sanitizer
1 parent 8614563 commit d834cec

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

python/ql/test/query-tests/Functions/ModificationOfParameterWithDefault/ModificationOfParameterWithDefault.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ edges
1414
| test.py:97:21:97:21 | ControlFlowNode for d | test.py:91:21:91:21 | ControlFlowNode for d |
1515
| test.py:113:20:113:20 | ControlFlowNode for d | test.py:115:5:115:5 | ControlFlowNode for d |
1616
| test.py:119:29:119:29 | ControlFlowNode for d | test.py:121:5:121:5 | ControlFlowNode for d |
17+
| test.py:125:15:125:15 | ControlFlowNode for l | test.py:127:9:127:9 | ControlFlowNode for l |
1718
nodes
1819
| test.py:17:15:17:15 | ControlFlowNode for l | semmle.label | ControlFlowNode for l |
1920
| test.py:18:5:18:5 | ControlFlowNode for l | semmle.label | ControlFlowNode for l |
@@ -41,6 +42,8 @@ nodes
4142
| test.py:115:5:115:5 | ControlFlowNode for d | semmle.label | ControlFlowNode for d |
4243
| test.py:119:29:119:29 | ControlFlowNode for d | semmle.label | ControlFlowNode for d |
4344
| test.py:121:5:121:5 | ControlFlowNode for d | semmle.label | ControlFlowNode for d |
45+
| test.py:125:15:125:15 | ControlFlowNode for l | semmle.label | ControlFlowNode for l |
46+
| test.py:127:9:127:9 | ControlFlowNode for l | semmle.label | ControlFlowNode for l |
4447
#select
4548
| test.py:18:5:18:5 | ControlFlowNode for l | test.py:17:15:17:15 | ControlFlowNode for l | test.py:18:5:18:5 | ControlFlowNode for l | $@ flows to here and is mutated. | test.py:17:15:17:15 | ControlFlowNode for l | Default value |
4649
| test.py:23:5:23:5 | ControlFlowNode for l | test.py:22:15:22:15 | ControlFlowNode for l | test.py:23:5:23:5 | ControlFlowNode for l | $@ flows to here and is mutated. | test.py:22:15:22:15 | ControlFlowNode for l | Default value |
@@ -53,3 +56,4 @@ nodes
5356
| test.py:92:5:92:5 | ControlFlowNode for d | test.py:96:26:96:26 | ControlFlowNode for d | test.py:92:5:92:5 | ControlFlowNode for d | $@ flows to here and is mutated. | test.py:96:26:96:26 | ControlFlowNode for d | Default value |
5457
| test.py:115:5:115:5 | ControlFlowNode for d | test.py:113:20:113:20 | ControlFlowNode for d | test.py:115:5:115:5 | ControlFlowNode for d | $@ flows to here and is mutated. | test.py:113:20:113:20 | ControlFlowNode for d | Default value |
5558
| test.py:121:5:121:5 | ControlFlowNode for d | test.py:119:29:119:29 | ControlFlowNode for d | test.py:121:5:121:5 | ControlFlowNode for d | $@ flows to here and is mutated. | test.py:119:29:119:29 | ControlFlowNode for d | Default value |
59+
| test.py:127:9:127:9 | ControlFlowNode for l | test.py:125:15:125:15 | ControlFlowNode for l | test.py:127:9:127:9 | ControlFlowNode for l | $@ flows to here and is mutated. | test.py:125:15:125:15 | ControlFlowNode for l | Default value |

python/ql/test/query-tests/Functions/ModificationOfParameterWithDefault/test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,9 @@ def dict_update_op_nochange(d = {}):
120120
x = {}
121121
d |= x # FP
122122
return d
123+
124+
# OK
125+
def sanitizer(l = []):
126+
if not l == []:
127+
l.append(1) # FP
128+
return l

0 commit comments

Comments
 (0)