Skip to content

[runtime] Fortify the swift_demangle API. #2169

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

Merged
merged 2 commits into from
Apr 14, 2016
Merged

[runtime] Fortify the swift_demangle API. #2169

merged 2 commits into from
Apr 14, 2016

Conversation

AnnaZaks
Copy link
Contributor

Remove the reference to String, which leaks internal implementation details,
check for invalid inputs, and make the API more flexible. Remove the similar
Swift API, since it provides no additional value.

@AnnaZaks
Copy link
Contributor Author

@swift-ci Please test

flags: 0)

if (demangledNamePtr == nil) {
return mangledName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra semicolon 😄

@AnnaZaks AnnaZaks force-pushed the demangle branch 2 times, most recently from a969035 to f988707 Compare April 14, 2016 05:45
@AnnaZaks
Copy link
Contributor Author

@swift-ci Please test

@AnnaZaks
Copy link
Contributor Author

@swift-ci Please smoke test Linux platform

#define SWIFT_RUNTIME_PORTABILITY_H
#include <stddef.h>

size_t _swift_strlcpy(char *dst, const char *src, size_t maxlen);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wrap in extern "C".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed not to wrap in extern "C" because this is not a publicly exposed API.

Remove the reference to String, which leaks internal implementation details,
check for invalid inputs, and make the API more flexible. Remove the similar
Swift API, since it provides no additional value.
This safer function is missing on Linux.
@AnnaZaks
Copy link
Contributor Author

@swift-ci Please smoke test Linux platform

@AnnaZaks AnnaZaks merged commit 4bf4fba into master Apr 14, 2016
// Indicate a failure if the result does not fit and will be truncated
// and set the required outputBufferSize.
if (*outputBufferSize < result.length() + 1) {
*outputBufferSize = result.length() + 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe always set size?

@gribozavr gribozavr deleted the demangle branch April 27, 2016 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants