-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[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
Conversation
@swift-ci Please test |
flags: 0) | ||
|
||
if (demangledNamePtr == nil) { | ||
return mangledName; |
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.
Extra semicolon 😄
a969035
to
f988707
Compare
@swift-ci Please test |
@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); |
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.
Please wrap in extern "C"
.
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.
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.
@swift-ci Please smoke test Linux platform |
// 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; |
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.
Maybe always set size?
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.