-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Swift: Models for String methods involving closures. #14578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4cf40ed
d3063e8
a520602
79f675c
d2d70cc
bf6e6a1
bf50384
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| category: minorAnalysis | ||
| --- | ||
|
|
||
| * Added flow models for `String` methods involving closures such as `String.withUTF8(_:)`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,10 @@ private class StringSummaries extends SummaryModelCsv { | |
| ";StringProtocol;true;trimmingCharacters(in:);;;Argument[-1];ReturnValue;taint", | ||
| ";StringProtocol;true;uppercased();;;Argument[-1];ReturnValue;taint", | ||
| ";StringProtocol;true;uppercased(with:);;;Argument[-1];ReturnValue;taint", | ||
| ";StringProtocol;true;withCString(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint", | ||
| ";StringProtocol;true;withCString(_:);;;Argument[0].ReturnValue;ReturnValue;value", | ||
| ";StringProtocol;true;withCString(encodedAs:_:);;;Argument[-1];Argument[1].Parameter[0].CollectionElement;taint", | ||
| ";StringProtocol;true;withCString(encodedAs:_:);;;Argument[1].ReturnValue;ReturnValue;value", | ||
| ";String;true;init(decoding:);;;Argument[0];ReturnValue;taint", | ||
| ";String;true;init(_:);;;Argument[0];ReturnValue;taint", | ||
| ";String;true;init(_:);;;Argument[0];ReturnValue.OptionalSome;taint", | ||
|
|
@@ -110,6 +114,7 @@ private class StringSummaries extends SummaryModelCsv { | |
| ";String;true;init(validating:);;;Argument[0];ReturnValue.OptionalSome;taint", | ||
| ";String;true;init(validatingPlatformString:);;;Argument[0];ReturnValue.OptionalSome;taint", | ||
| ";String;true;init(validatingPlatformString:);;;Argument[0].CollectionElement;ReturnValue.OptionalSome;taint", | ||
| ";String;true;init(unsafeUninitializedCapacity:initializingUTF8With:);;;Argument[1].Parameter[0].CollectionElement;ReturnValue;taint", | ||
| ";String;true;localizedStringWithFormat(_:_:);;;Argument[0];ReturnValue;taint", | ||
| ";String;true;localizedStringWithFormat(_:_:);;;Argument[1].CollectionElement;ReturnValue;taint", | ||
| ";String;true;insert(contentsOf:at:);;;Argument[0];Argument[-1];taint", | ||
|
|
@@ -125,6 +130,15 @@ private class StringSummaries extends SummaryModelCsv { | |
| ";String;true;encode(to:);;;Argument[-1];Argument[0];taint", | ||
| ";String;true;decodeCString(_:as:repairingInvalidCodeUnits:);;;Argument[0];ReturnValue.TupleElement[0];taint", | ||
| ";String;true;decodeCString(_:as:repairingInvalidCodeUnits:);;;Argument[0].CollectionElement;ReturnValue.TupleElement[0];taint", | ||
| ";String;true;withUTF8(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint", | ||
| ";String;true;withUTF8(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1];taint", | ||
| ";String;true;withUTF8(_:);;;Argument[0].ReturnValue;ReturnValue;value", | ||
| ";String;true;withPlatformString(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint", | ||
| ";String;true;withPlatformString(_:);;;Argument[0].ReturnValue;ReturnValue;value", | ||
|
Comment on lines
+136
to
+137
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you can mutate the string with these particular methods. I'll check...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for taking a while to get back to this. I think it's only possible to modify the object using the methods marked Some experimentation here - notice that the changes are never reflected back in |
||
| ";String;true;withMutableCharacters(_:);;;Argument[-1];Argument[0].Parameter[0];value", | ||
| ";String;true;withMutableCharacters(_:);;;Argument[0].Parameter[0];Argument[-1];value", | ||
| ";String;true;withMutableCharacters(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1];taint", | ||
| ";String;true;withMutableCharacters(_:);;;Argument[0].ReturnValue;ReturnValue;value", | ||
| ";LosslessStringConvertible;true;init(_:);;;Argument[0];ReturnValue;taint", | ||
| ";Substring;true;withUTF8(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint", | ||
| ";Substring;true;withUTF8(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1];taint", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a step from the mutated parameter of the callback to the
thisparameter of the method?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed on the other comment.