Skip to content

Commit 34f78d4

Browse files
committed
Python: Add BarrierGuard test with return inside unsafe branch
1 parent 6c8937c commit 34f78d4

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

python/ql/test/experimental/dataflow/tainttracking/customSanitizer/TestTaint.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ test_taint
3232
| test_logical.py:123 | ok | test_nesting_not_with_and_true | s |
3333
| test_logical.py:126 | ok | test_nesting_not_with_and_true | s |
3434
| test_logical.py:128 | ok | test_nesting_not_with_and_true | s |
35+
| test_logical.py:137 | fail | test_with_return | s |
3536
isSanitizer
3637
| TestTaintTrackingConfiguration | test.py:21:39:21:39 | ControlFlowNode for s |
3738
| TestTaintTrackingConfiguration | test.py:50:10:50:29 | ControlFlowNode for emulated_escaping() |

python/ql/test/experimental/dataflow/tainttracking/customSanitizer/test_logical.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ def test_nesting_not_with_and_true():
128128
ensure_not_tainted(s)
129129

130130

131+
def test_with_return():
132+
s = TAINTED_STRING
133+
134+
if not is_safe(s):
135+
return
136+
137+
ensure_not_tainted(s)
138+
139+
131140
# Make tests runable
132141

133142
test_basic()
@@ -136,3 +145,4 @@ def test_nesting_not_with_and_true():
136145
test_tricky()
137146
test_nesting_not()
138147
test_nesting_not_with_and_true()
148+
test_with_return()

0 commit comments

Comments
 (0)