Skip to content

Commit 08bcba9

Browse files
committed
Python: Add BarrierGuard test with exception inside unsafe branch
1 parent 34f78d4 commit 08bcba9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ test_taint
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 |
3535
| test_logical.py:137 | fail | test_with_return | s |
36+
| test_logical.py:146 | fail | test_with_exception | s |
3637
isSanitizer
3738
| TestTaintTrackingConfiguration | test.py:21:39:21:39 | ControlFlowNode for s |
3839
| TestTaintTrackingConfiguration | test.py:50:10:50:29 | ControlFlowNode for emulated_escaping() |

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ def test_with_return():
137137
ensure_not_tainted(s)
138138

139139

140+
def test_with_exception():
141+
s = TAINTED_STRING
142+
143+
if not is_safe(s):
144+
raise Exception("unsafe")
145+
146+
ensure_not_tainted(s)
147+
140148
# Make tests runable
141149

142150
test_basic()
@@ -146,3 +154,7 @@ def test_with_return():
146154
test_nesting_not()
147155
test_nesting_not_with_and_true()
148156
test_with_return()
157+
try:
158+
test_with_exception()
159+
except:
160+
pass

0 commit comments

Comments
 (0)