File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
swift/ql/test/library-tests/dataflow/taint/libraries Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ extension String : CVarArg {
79
79
init ( platformString: UnsafePointer < CInterop . PlatformChar > ) { self . init ( ) }
80
80
81
81
func withPlatformString< Result> ( _ body: ( UnsafePointer < CInterop . PlatformChar > ) throws -> Result ) rethrows -> Result { return 0 as! Result }
82
-
82
+ mutating func withMutableCharacters < R > ( _ body : ( inout String ) -> R ) -> R { return 0 as! R }
83
83
84
84
85
85
mutating func replaceSubrange< C> ( _ subrange: Range < String . Index > , with newElements: C )
@@ -687,3 +687,18 @@ func testDecodeCString() {
687
687
sink ( arg: str4) // $ tainted=669
688
688
sink ( arg: repaired4)
689
689
}
690
+
691
+ func taintMutableCharacters( ) {
692
+ var str = " "
693
+
694
+ sink ( arg: str)
695
+ let rtn = str. withMutableCharacters ( {
696
+ chars in
697
+ sink ( arg: chars)
698
+ chars. append ( source2 ( ) )
699
+ sink ( arg: chars) // $ tainted=698
700
+ return source ( )
701
+ } )
702
+ sink ( arg: rtn) // $ MISSING: tainted=700
703
+ sink ( arg: str) // $ MISSING: tainted=698
704
+ }
You can’t perform that action at this time.
0 commit comments