|
4 | 4 | typealias unichar = UInt16 |
5 | 5 |
|
6 | 6 | class NSObject { |
| 7 | + func copy() -> Any { return 0 } |
| 8 | + func mutableCopy() -> Any { return 0 } |
7 | 9 | } |
8 | 10 |
|
9 | | -class NSString : NSObject { |
| 11 | +struct NSZone { |
| 12 | +} |
| 13 | + |
| 14 | +protocol NSCopying { |
| 15 | + func copy(with zone: NSZone?) -> Any |
| 16 | +} |
| 17 | + |
| 18 | +protocol NSMutableCopying { |
| 19 | + func mutableCopy(with zone: NSZone?) -> Any |
| 20 | +} |
| 21 | + |
| 22 | +class NSString : NSObject, NSCopying, NSMutableCopying { |
10 | 23 | struct EncodingConversionOptions : OptionSet { |
11 | 24 | let rawValue: Int |
12 | 25 | } |
@@ -37,6 +50,9 @@ class NSString : NSObject { |
37 | 50 | convenience init?(contentsOfFile path: String) { self.init(string: "") } |
38 | 51 | convenience init?(contentsOf url: URL) { self.init(string: "") } |
39 | 52 |
|
| 53 | + func copy(with zone: NSZone? = nil) -> Any { return 0 } |
| 54 | + func mutableCopy(with zone: NSZone? = nil) -> Any { return 0 } |
| 55 | + |
40 | 56 | class func localizedStringWithFormat(_ format: NSString, _ args: CVarArg) -> Self { return (nil as Self?)! } |
41 | 57 | class func path(withComponents components: [String]) -> String { return "" } |
42 | 58 | class func string(withCString bytes: UnsafePointer<CChar>) -> Any? { return nil } |
@@ -322,4 +338,13 @@ func taintThroughInterpolatedStrings() { |
322 | 338 | sink(arg: outBuffer) // $ MISSING: tainted= |
323 | 339 | sink(arg: outBuffer.pointee) // $ MISSING: tainted= |
324 | 340 | } |
| 341 | + |
| 342 | + // `NSObject` methods |
| 343 | + |
| 344 | + var str20 = sourceNSString() |
| 345 | + |
| 346 | + sink(arg: str20.copy()) // $ MISSING: tainted= |
| 347 | + sink(arg: str20.mutableCopy()) // $ MISSING: tainted= |
| 348 | + sink(arg: str20.copy(with: nil)) // $ MISSING: tainted= |
| 349 | + sink(arg: str20.mutableCopy(with: nil)) // $ MISSING: tainted= |
325 | 350 | } |
0 commit comments