Skip to content

Commit 53f52df

Browse files
committed
Swift: Add taint test cases for overflow, bitwise and pointwise arithmetic operations.
1 parent c42add2 commit 53f52df

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

swift/ql/test/library-tests/dataflow/taint/core/simple.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,21 @@ func taintThroughAssignmentArithmetic() {
6868
e %= 100
6969
sink(arg: e) // $ tainted=66
7070
}
71+
72+
func taintThroughBitwiseOperators() {
73+
sink(arg: 0 | source()) // $ MISSING: tainted=73
74+
sink(arg: source() | 0) // $ MISSING: tainted=74
75+
76+
sink(arg: 0xffff & source()) // $ MISSING: tainted=76
77+
sink(arg: source() & 0xffff) // $ MISSING: tainted=77
78+
79+
sink(arg: 0xffff ^ source()) // $ MISSING: tainted=79
80+
sink(arg: source() ^ 0xffff) // $ MISSING: tainted=80
81+
82+
sink(arg: source() << 1) // $ MISSING: tainted=82
83+
sink(arg: source() &<< 1) // $ MISSING: tainted=83
84+
sink(arg: source() >> 1) // $ MISSING: tainted=84
85+
sink(arg: source() &>> 1) // $ MISSING: tainted=85
86+
87+
sink(arg: ~source()) // $ MISSING: tainted=87
88+
}

0 commit comments

Comments
 (0)