Merge pull request #18154 from geoffw0/swift6models4

Swift: Fix for OptionSet and BinaryInteger models
This commit is contained in:
Geoffrey White
2024-11-29 17:30:51 +00:00
committed by GitHub
3 changed files with 6 additions and 5 deletions

View File

@@ -12,7 +12,11 @@ private import codeql.swift.dataflow.FlowSteps
*/
private class RawRepresentableSummaries extends SummaryModelCsv {
override predicate row(string row) {
row = ";RawRepresentable;true;init(rawValue:);;;Argument[0];ReturnValue;taint"
row =
[
";RawRepresentable;true;init(rawValue:);;;Argument[0];ReturnValue;taint",
";OptionSet;true;init(rawValue:);;;Argument[0];ReturnValue;taint"
]
}
}

View File

@@ -167,7 +167,7 @@ private class StringFieldsInheritTaint extends TaintInheritingContent,
"precomposedStringWithCompatibilityMapping", "removingPercentEncoding"
]
or
namedTypeDecl.getFullName() = "CustomStringConvertible" and
namedTypeDecl.getFullName() = ["CustomStringConvertible", "BinaryInteger"] and
fieldDecl.getName() = "description"
or
namedTypeDecl.getFullName() = "CustomDebugStringConvertible" and

View File

@@ -1,5 +1,2 @@
testFailures
| optionset.swift:60:49:61:1 | // $ tainted=60\n | Missing result: tainted=60 |
| optionset.swift:65:58:66:1 | // $ tainted=65\n | Missing result: tainted=65 |
| string.swift:599:35:600:1 | // $ tainted=599\n | Missing result: tainted=599 |
failures